上一页 1 ··· 18 19 20 21 22 23 24 25 26 ··· 95 下一页
摘要: 简介 先进行中序遍历然后, 对指针进行迁移, 顺便对节点数据进行迁移. code /** * Definition for a binary tree node. * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; 阅读全文
posted @ 2021-06-02 21:13 HDU李少帅 阅读(32) 评论(0) 推荐(0)
摘要: 简介 回溯 code class Solution { public: int n; int m; bool find; void dfs(vector<vector<char>>& board, vector<vector<bool>>& visited, string &word, int in 阅读全文
posted @ 2021-06-02 20:50 HDU李少帅 阅读(40) 评论(0) 推荐(0)
摘要: 简介 思路: 后面开始放置元素. code class Solution { public: void merge(vector<int>& nums1, int m, vector<int>& nums2, int n) { int i=m-1; int j=n-1; int index = n 阅读全文
posted @ 2021-06-02 20:26 HDU李少帅 阅读(26) 评论(0) 推荐(0)
摘要: 参考链接 https://blog.csdn.net/luoyayun361/article/details/80428882 函数指针 本质是指针, 不过可以指向函数 int (*fun)(int x,int y); 指针函数 本质是函数, 返回的是指针 int *fun(int x,int y) 阅读全文
posted @ 2021-06-02 15:19 HDU李少帅 阅读(40) 评论(0) 推荐(0)
摘要: 简介 一时半会儿没啥思路. 官方那种 移动指针的思路挺不错的. code class Solution { public boolean searchMatrix(int[][] matrix, int target) { int row = matrix.length - 1; int col = 阅读全文
posted @ 2021-06-02 11:10 HDU李少帅 阅读(39) 评论(0) 推荐(0)
摘要: 简介 容易想到的方法就是 map , set 之类的. code class Solution { public: ListNode *detectCycle(ListNode *head) { if(head == nullptr) return nullptr; ListNode *p = he 阅读全文
posted @ 2021-06-02 10:53 HDU李少帅 阅读(30) 评论(0) 推荐(0)
摘要: 简介 自底部向上 使用回溯 超时算法 class Solution { public: int minValue; void dfs(vector<vector<int>>& triangle, int value, int depth, int index){ if(depth == triang 阅读全文
posted @ 2021-05-31 19:21 HDU李少帅 阅读(41) 评论(0) 推荐(0)
摘要: 简介 直接使用reverse, 进行值的替换, 链表翻转实在是太烦了 code class Solution { public: ListNode* reverseBetween(ListNode* head, int left, int right) { vector<int> v; ListNo 阅读全文
posted @ 2021-05-31 12:03 HDU李少帅 阅读(33) 评论(0) 推荐(0)
摘要: 简介 链表中倒数第K个节点. 思路 双指针, 然后一个指针延迟运行. code class Solution { public: ListNode* getKthFromEnd(ListNode* head, int k) { ListNode *p = head; ListNode *pk = h 阅读全文
posted @ 2021-05-31 11:29 HDU李少帅 阅读(33) 评论(0) 推荐(0)
摘要: 简介 对于java这种功能比较全相对于c++, 比较好写代码, 但是缺点也比较多, 要记住太多的接口语句. code class Solution { public int compareVersion(String version1, String version2) { String [] nu 阅读全文
posted @ 2021-05-31 10:56 HDU李少帅 阅读(52) 评论(0) 推荐(0)
上一页 1 ··· 18 19 20 21 22 23 24 25 26 ··· 95 下一页