①题目 给定一个二叉树和一个目标和,判断该树中是否存在根节点到叶子节点的路径,这条路径上所有节点值相加等于目标和。 说明: 叶子节点是指没有子节点的节点。 示例: 给定如下二叉树,以及目标和 sum = 22, 返回 true, 因为存在目标和为 22 的根节点到叶子节点的路径 5->4->11-> ...
分类:
其他好文 时间:
2019-10-13 23:46:54
阅读次数:
211
Given an integer array nums, find the contiguous subarray (containing at least one number) which has the largest sum and return its sum. Example: ...
分类:
其他好文 时间:
2019-10-13 23:34:58
阅读次数:
112
Given a string S and a string T, find the minimum window in S which will contain all the characters in T in complexity O(n). Example: Note: If there i ...
Given a string s and a non-empty string p, find all the start indices of p's anagrams in s. Strings consists of lowercase English letters only and the ...
分类:
其他好文 时间:
2019-10-11 12:49:09
阅读次数:
72
Given an array nums of n integers, are there elements a, b, c in nums such that a + b + c = 0? Find all unique triplets in the array which gives the s ...
分类:
其他好文 时间:
2019-10-11 10:31:45
阅读次数:
91
/etc/locale.conf 中 里面默认只有一行: LANG="en_US.UTF-8"这表示系统语言是英语, 应该改成下面这样: LANG="en_US.UTF-8"LC_CTYPE="zh_CN.UTF-8"LC_ALL="en_US.UTF-8"LC_CTYPE 表示语言和类别符号,设置 ...
分类:
其他好文 时间:
2019-10-09 12:48:45
阅读次数:
131
①题目 给定一个二叉树,找出其最小深度。 最小深度是从根节点到最近叶子节点的最短路径上的节点数量。 说明: 叶子节点是指没有子节点的节点。 示例: 给定二叉树 [3,9,20,null,null,15,7], 返回它的最小深度 2. ②思路 使用深度优先搜索 ③代码 ④学到的东西 1、判断叶子结点, ...
分类:
其他好文 时间:
2019-10-08 22:01:25
阅读次数:
68
①题目 给定一个所有节点为非负值的二叉搜索树,求树中任意两节点的差的绝对值的最小值。 示例 : 输入: 1 \ 3 / 2 输出:1 解释:最小绝对差为1,其中 2 和 1 的差的绝对值为 1(或者 2 和 3)。注意: 树中至少有2个节点。 ②思路 这个题我自己没做出来,所以看了别人的题解。 思路 ...
分类:
其他好文 时间:
2019-10-08 19:07:10
阅读次数:
67
题目描述 Reverse a singly linked list. Example: 参考答案 补充说明 term 1: temp = 2 3 4 5 null head = 1 null = 1 2 3 4 5 null + null cur = 1 null head = 2 3 4 5 nu ...
分类:
其他好文 时间:
2019-10-06 13:46:52
阅读次数:
96
题目描述 Given a linked list, return the node where the cycle begins. If there is no cycle, return null. To represent a cycle in the given linked list, we ...
分类:
其他好文 时间:
2019-10-05 20:32:28
阅读次数:
122