链接:https://leetcode-cn.com/problems/word-search/ 代码 class Solution { public: bool exist(vector<vector<char>>& board, string word) { for (int i = 0; i ...
分类:
其他好文 时间:
2020-07-14 21:55:49
阅读次数:
84
链接:https://leetcode-cn.com/problems/sort-colors/ 代码 class Solution { public: void sortColors(vector<int>& nums) { for (int i = 0, j = 0, k = nums.size ...
分类:
其他好文 时间:
2020-07-14 18:45:30
阅读次数:
62
1、LeetCode 160 相交链表 题目链接:https://leetcode-cn.com/problems/intersection-of-two-linked-lists/ 编写一个程序,找到两个单链表相交的起始节点。 如下面的两个链表: 在节点c1开始相交。 示例 1: 输入:inter ...
分类:
其他好文 时间:
2020-07-14 18:13:25
阅读次数:
53
地址 https://leetcode-cn.com/problems/triangle/ 给定一个三角形,找出自顶向下的最小路径和每一步只能移动到下一行中相邻的结点上。 相邻的结点 在这里指的是 下标 与 上一层结点下标 相同或者等于 上一层结点下标 + 1 的两个结点。 例如,给定三角形: [ ...
分类:
其他好文 时间:
2020-07-14 13:50:26
阅读次数:
58
题目来源:https://leetcode-cn.com/problems/string-rotation-lcci/ 字符串轮转。给定两个字符串s1和s2,请编写代码检查s2是否为s1旋转而成(比如,waterbottle是erbottlewat旋转后的字符串)。 示例1: 输入:s1 = "wa ...
分类:
其他好文 时间:
2020-07-14 01:03:07
阅读次数:
85
package LeetCode_166 /** * 166. Fraction to Recurring Decimal * https://leetcode.com/problems/fraction-to-recurring-decimal/description/ * * Given two ...
分类:
其他好文 时间:
2020-07-14 00:36:05
阅读次数:
87
(要熟练!)(树的遍历) ##题目大意 (题目链接)https://pintia.cn/problem-sets/994805342720868352/problems/994805424153280512 题目大意:给出树的结构和权值,找从根结点到叶子结点的路径上的权值相加之和等于给定目标数的路径 ...
分类:
其他好文 时间:
2020-07-14 00:27:26
阅读次数:
59
题目描述 在 O(n log n) 时间复杂度和常数级空间复杂度下,对链表进行排序。 示例: 输入: 4->2->1->3 输出: 1->2->3->4 题目链接: https://leetcode-cn.com/problems/sort-list/ 思路1 使用两个栈来做,类似于栈排序的方法。代 ...
分类:
编程语言 时间:
2020-07-13 21:56:15
阅读次数:
71
题目链接 https://leetcode-cn.com/problems/binary-tree-inorder-traversal/ 题解一:递归 // Problem: LeetCode 94 // URL: https://leetcode-cn.com/problems/binary-tr ...
分类:
其他好文 时间:
2020-07-13 15:36:49
阅读次数:
58
题目链接 https://leetcode-cn.com/problems/binary-tree-preorder-traversal/description/ 题解一:递归 // Problem: LeetCode 144 // URL: https://leetcode-cn.com/prob ...
分类:
其他好文 时间:
2020-07-13 00:00:50
阅读次数:
90