牛客768685351号
牛客768685351号
全部文章
分类
题解(160)
归档
标签
去牛客网
登录
/
注册
牛客768685351号的博客
全部文章
(共163篇)
题解 | #最长公共子串#
dp[i][j] 表示以str1[i]结尾和以str2[j]结尾的最长子串; 要注意和最长公共子序列这道题的差异 class Solution { public: /** * longest common substring * @param str1 string字符串...
C++
2022-02-22
0
373
题解 | #删除链表的倒数第n个节点#
/** * struct ListNode { * int val; * struct ListNode *next; * ListNode(int x) :val(x), next(NULL) {} * }; */ class Solution { public: /** ...
C++
2022-02-22
0
299
题解 | #有效括号序列#
class Solution { public: /** * * @param s string字符串 * @return bool布尔型 */ bool isValid(string s) { // write code ...
C++
2022-02-22
0
313
题解 | #最长无重复子数组#
双指针+哈希表 class Solution { public: /** * * @param arr int整型vector the array * @return int整型 */ int maxLength(vector<int&...
C++
2022-02-22
0
275
题解 | #链表中的节点每k个一组翻转#
/** * struct ListNode { * int val; * struct ListNode *next; * }; */ class Solution { public: /** * * @param head ListNode类 ...
C++
2022-02-22
0
251
题解 | #跳台阶#
class Solution { public: int jumpFloor(int number) { if(number <= 2){ return number; } int n_2 = 1...
C++
2022-02-22
0
244
题解 | #用两个栈实现队列#
class Solution { public: void push(int node) { stack1.push(node); } int pop() { if(stack2.empty()){ while(!st...
C++
2022-02-22
0
198
题解 | #合并两个排序的链表#
/* struct ListNode { int val; struct ListNode *next; ListNode(int x) : val(x), next(NULL) { } };*/ class Solution { public: ListNode* Merge...
C++
2022-02-22
0
291
题解 | #两数之和#
使用哈希表解决 class Solution { public: /** * * @param numbers int整型vector * @param target int整型 * @return int整型vector */ ...
C++
2022-02-22
0
249
题解 | #寻找第K大#
(1)没有满足题意,使用优先队列求解 class Solution { public: int findKth(vector<int> a, int n, int K) { // write code here priority_queue<...
C++
2022-02-22
0
289
首页
上一页
8
9
10
11
12
13
14
15
16
17
下一页
末页