牛客768685351号
牛客768685351号
全部文章
题解
归档
标签
去牛客网
登录
/
注册
牛客768685351号的博客
全部文章
/ 题解
(共160篇)
题解 | #最长无重复子数组#
双指针+哈希表 class Solution { public: /** * * @param arr int整型vector the array * @return int整型 */ int maxLength(vector<int&...
C++
2022-02-22
0
273
题解 | #链表中的节点每k个一组翻转#
/** * struct ListNode { * int val; * struct ListNode *next; * }; */ class Solution { public: /** * * @param head ListNode类 ...
C++
2022-02-22
0
250
题解 | #跳台阶#
class Solution { public: int jumpFloor(int number) { if(number <= 2){ return number; } int n_2 = 1...
C++
2022-02-22
0
241
题解 | #用两个栈实现队列#
class Solution { public: void push(int node) { stack1.push(node); } int pop() { if(stack2.empty()){ while(!st...
C++
2022-02-22
0
196
题解 | #合并两个排序的链表#
/* struct ListNode { int val; struct ListNode *next; ListNode(int x) : val(x), next(NULL) { } };*/ class Solution { public: ListNode* Merge...
C++
2022-02-22
0
286
题解 | #两数之和#
使用哈希表解决 class Solution { public: /** * * @param numbers int整型vector * @param target int整型 * @return int整型vector */ ...
C++
2022-02-22
0
247
题解 | #寻找第K大#
(1)没有满足题意,使用优先队列求解 class Solution { public: int findKth(vector<int> a, int n, int K) { // write code here priority_queue<...
C++
2022-02-22
0
288
题解 | #最小的K个数#
采用优先队列来求解问题 class Solution { public: vector<int> GetLeastNumbers_Solution(vector<int> input, int k) { if(k == 0){ ...
C++
2022-02-22
0
331
题解 | #实现二叉树先序,中序和后序遍历#
使用递归解决 /** * struct TreeNode { * int val; * struct TreeNode *left; * struct TreeNode *right; * }; */ class Solution { public: /** * ...
C++
2022-02-21
0
272
题解 | #排序#
归并排序:先分裂后整合,依据这个思路来写代码; class Solution { public: /** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * 将给定数组排序 * @param arr int整型vector 待排序的...
C++
2022-02-21
0
350
首页
上一页
7
8
9
10
11
12
13
14
15
16
下一页
末页