leetcode mountain index array

每日一题 力扣 445 https://leetcode.cn/problems/add-two-numbers-ii/

可以直接用栈去做就行,逆序想到栈的做法 然后算完一个就直接赋值给答案数组 我用的是常见 public ListNode addTwoNumbers(ListNode l1, ListNode l2) { int sizeA=0; int sizeB=0; ListNode start=l1; Lis ......

leetcode933使用队列

输入的时间是递增的 输出 的时[t-3000,t] queue <int>q; int ping(int t){ q.push(t); while(q.front<t-3000){ q,pop(); } return q.size(); } ......
队列 leetcode 933

LeetCode -- 767. 重构字符串

设字符串s长度为len s可以重构为相邻字符串不同时 有字符串中出现次数最多的字符 < (len + 1) >> 1 当满足上述条件时候,我们就能对其进行重构 重构法:先放置偶数位置,再放置奇数位置 c ++ class Solution { public: string reorganizeStr ......
字符串 字符 LeetCode 767

C++面试八股文:std::array如何实现编译器排序?

# C++面试八股文:std::array如何实现编译器排序? 某日二师兄参加XXX科技公司的C++工程师开发岗位第25面: > 面试官:`array`熟悉吗? > 二师兄:你说的是原生数组还是`std::array`? > 面试官:你觉得两者有什么区别? > 二师兄:区别不是很大,原生数组(非动态 ......
八股文 八股 编译器 array std

【LeetCode剑指offer#05】回文链表的两种解法+删除链表中间节点(链表的基本操作)

### 回文链表 给你一个单链表的头节点 head ,请你判断该链表是否为回文链表。如果是,返回 true ;否则,返回 false 。 示例 1: 输入:head = [1,2,2,1] 输出:true 示例 2: 输入:head = [1,2] 输出:false 提示: 链表中节点数目在范围[1 ......
回文 解法 基本操作 节点 LeetCode

【leetcode】【1474】【删除链表 M 个节点之后的 N 个节点】

# c++ ## 第一个方法 ```c++ #include #include #include #include // Definition for singly-linked list. struct ListNode { int val; ListNode* next; ListNode() ......
节点 leetcode 1474

【笔试实战】LeetCode题单刷题-编程基础 0 到 1【一】

摘要: 博客推行版本更新,成果积累制度,已经写过的博客还会再次更新,不断地琢磨,高质量高数量都是要追求的,工匠精神是学习必不可少的精神。因此,大家有何建议欢迎在评论区踊跃发言,你们的支持是我最大的动力,你们敢投,我就敢肝 ......
笔试 实战 LeetCode 基础

【leetcode】【876】【链表的中间结点】

# c++ ## 第一个方法 ```c++ #include #include #include #include // Definition for singly-linked list. struct ListNode { int val; ListNode* next; ListNode() ......
结点 leetcode 876

LeetCode/和等于目标值的质数对

给你一个整数n,如果两个整数 x 和 y 满足下述条件,则认为二者形成一个质数对: * 1 prime(10e6,true); bool flag = false; void getprime(){//埃氏筛预处理 for(int i=2;i> findPrimePairs(int n) { if( ......
目标值 质数 LeetCode 目标

array_reduce的使用

当使用 `array_reduce` 函数编写博客时,可以使用它来对一个数组进行迭代并将每个元素归约(规约)成一个单一的值。下面是一个简单的示例来说明它的用法: // 假设我们有一个博客数组,每个博客都有一个评论数 ``` $blogs = [ ['title' => '博客1', 'comment ......
array_reduce reduce array

LeetCode-Python-#27 移除元素

题目描述 给定一个数列nums和数值val,消除数列nums中与数值 val相同的元素,最终返回新数列的长度;要求:不能开辟空间分配新的数列,必须改变原输入nums数列;并对修改后的nums数列的元素顺序没有要求,可以被修改。 Examples nums=[3,2,2,3; val=3 则返回长度为 ......
LeetCode-Python LeetCode 元素 Python 27

2023/07/02 leetcode刷题记录

#### 1 无重复字符的最长子串 给定一个**字符串 s** ,请你找出其中不含有重复字符的 **最长子串** 的长度。 代码 ``` class Solution { public: int lengthOfLongestSubstring(string s) { //解题思路: //先向右遍历 ......
leetcode 2023 07 02

LeetCode-146-LRU缓存

title: LeetCode-146-LRU缓存 date: 2022-11-18 23:17:17 tags: # 146题:LRU缓存 ## 题目 请你设计并实现一个满足 LRU (最近最少使用) 缓存 约束的数据结构。 实现 `LRUCache` 类: `LRUCache(int capac ......
缓存 LeetCode 146 LRU

[刷题记录Day1]Leetcode列表专题

# No.1 ## 题目 [二分查找](https://leetcode.cn/problems/binary-search/) ## 思路 - 要素:原数组升序排列 - 清楚地定义左右边界 - 优化空间:数组有序,通过第0元素和最后元素,可以避免查找不在数组范围内的target ## 代码 ``` ......
Leetcode 专题 Day1 Day

【leetcode】【234】【回文链表】

# c++ ## 第一个方法 ```c++ #include #include #include #include // Definition for singly-linked list. struct ListNode { int val; ListNode* next; ListNode() ......
回文 leetcode 234

[刷题记录Day3]Leetcode链表专题

```Java # ListNode definition public class ListNode { // 结点的值 int val; // 下一个结点 ListNode next; // 节点的构造函数(无参) public ListNode() { } // 节点的构造函数(有一个参数) ......
Leetcode 专题 Day3 Day

【leetcode】【206】【反转链表】

# c++ ## 第一个方法 ```c++ #include #include #include #include // Definition for singly-linked list. struct ListNode { int val; ListNode* next; ListNode() ......
leetcode 206

【leetcode】【83】【移除链表元素】

# c++ ## 第一个方法 ```c++ #include #include #include #include // Definition for singly-linked list. struct ListNode { int val; ListNode* next; ListNode() ......
leetcode 元素

LeetCode 142. 环形链表 II

``` /** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode(int x) : val(x), next(NULL) {} * }; */ class ......
环形 LeetCode 142 II

[刷题记录]Leetcode列表专题

# No.1 ## 题目 [Leetcode link](https://leetcode.cn/problems/squares-of-a-sorted-array/) ## 思路 * 数组本身是非降序,即最小值和最大值在数组的两端 * 非降序数组每个元素平方后,最大值在两端,最小值在中部 * 双 ......
Leetcode 专题

CSS:z-index属性

如果**父 div 元素设置了 z-index:** 100 属性, 子 div 元素的行为将取决于其自身的 z-index 值和定位方式。 **子 div 元素没有显式设置 z-index:** 如果子 div 元素没有设置 position 属性,或者设置为 static,则子元素的层叠顺序将继 ......
属性 z-index index CSS

cpp: Two-level pointer and double dimensional array

/*****************************************************************//** * \file ConsoleTextFileDemoApp.cpp c++ 14 * \brief * * * \author geovindu * \da ......
dimensional Two-level pointer double array

LeetCode 141. 环形链表

#取巧 ``` class Solution { public: const int INF=1e9; bool hasCycle(ListNode *head) { bool res=false; auto p=head; while(p) { if(p->val==INF) { res=true ......
环形 LeetCode 141

leetcode 19. 删除链表的倒数第 N 个结点

链表问题,需要注意一下是倒着数还是正着数,和头结点会不会被删除即可 ```java public ListNode removeNthFromEnd(ListNode head, int n) { if (head == null) { return null; } // 头结点会被删除吗? int ......
结点 leetcode 19

Leetcode 20. 有效的括号

可以将反括号先存入map中,而后如果当前字符能在map中查到,说明是反括号,否则是正括号。 但是结合map的使用和将反括号作为map的key,并不容易第一时间想到。 class Solution { public: bool isValid(string s) { int n = s.size(); ......
括号 Leetcode 20

vue+ts项目出现types\express-serve-static-core\index.d.ts报错处理

如果出现`types\express-serve-static-core\index.d.ts` 的错误可以固定TS版本 ```js cnpm install typescript@4.1.6 cnpm install -D @types/express-serve-static-core@4.17 ......

【leetcode】【83】【删除排序链表中的重复元素】

# c++ ## 第一个方法 ### 代码 ```c++ #include #include #include #include // Definition for singly-linked list. struct ListNode { int val; ListNode* next; List ......
leetcode 元素

【leetcode】【21】【合并两个有序链表】

# c++ ## 第一个方法 ### 代码 ```c++ /** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode() : val(0), next(nul ......
leetcode 两个

https://leetcode.cn/ 第9题 判断回文数

# 回文数 121 是; 123 不是 #定义一个函数 判断是否是回文数 def get_Hui(num): #将整数num转字符串 str_num = str(num) str_num_change = str_num[::-1] num2 = int(str_num_change) #判断整数n ......
回文 leetcode https cn

array_merge详解

1、array_merge — 合并一个或多个数组 array_merge(array ...$arrays): array 2、 将一个或多个数组的单元合并起来,一个数组中的值附加在前一个数组的后面。返回作为结果的数组。 <1> 如果输入的数组中有相同的字符串键名,则该键名后面的值将覆盖前一个值。 ......
array_merge array merge