夜深人静写bug
夜深人静写bug
全部文章
分类
题解(1)
归档
标签
去牛客网
登录
/
注册
夜深人静写bug的博客
全部文章
(共33篇)
题解 | #二叉树的前序遍历#
/** * struct TreeNode { * int val; * struct TreeNode *left; * struct TreeNode *right; * TreeNode(int x) : val(x), left(nullptr), right(nullptr) {...
2023-09-11
0
243
题解 | #比较版本号#
class Solution { public: int compare(string version1, string version2) { // write code here int i=0,j=0; int len1=version1...
2023-09-11
0
269
题解 | #数组中的逆序对#
class Solution { public: void merge(vector<int>& nums,vector<int>& v,int left,int right,int mid,int& count) { ...
2023-09-10
0
217
题解 | #寻找峰值#
class Solution { public: int findPeakElement(vector<int>& nums) { // write code here if ((nums.size() == 1) || nums[0]...
2023-09-10
0
223
题解 | #二分查找-I#
class Solution { public: /** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * * * @param nums int整型vector * @param target int整型...
2023-09-08
0
239
题解 | #删除有序链表中重复的元素-II#
/** * struct ListNode { * int val; * struct ListNode *next; * ListNode(int x) : val(x), next(nullptr) {} * }; */ class Solution { public: Li...
2023-09-08
0
266
题解 | #删除有序链表中重复的元素-I#
/** * struct ListNode { * int val; * struct ListNode *next; * ListNode(int x) : val(x), next(nullptr) {} * }; */ class Solution { public: Li...
2023-09-08
0
204
题解 | #链表的奇偶重排#
/** * struct ListNode { * int val; * struct ListNode *next; * ListNode(int x) : val(x), next(nullptr) {} * }; */ class Solution { public: Li...
2023-09-08
0
192
题解 | #判断一个链表是否为回文结构#
//两个栈,先遍历链表将值压入v1中,然后弹出v1栈顶上半部分压入v2中,注意链表节点是奇数个的情况,然后v1,v2比较是否相等 class Solution { public: bool isPail(ListNode* head) { if(!head) return t...
2023-09-07
0
243
题解 | #单链表的排序#
/** * struct ListNode { * int val; * struct ListNode *next; * ListNode(int x) : val(x), next(nullptr) {} * }; */ class Solution { public: Li...
2023-09-07
0
222
首页
上一页
1
2
3
4
下一页
末页