原题网址:https://www.lintcode.com/problem/minimum-depth-of-binary-tree/description 描述 给定一个二叉树,找出其最小深度。 二叉树的最小深度为根节点到最近叶子节点的距离。 描述 描述 给定一个二叉树,找出其最小深度。 二叉树的 ...
分类:
其他好文 时间:
2018-06-08 23:19:03
阅读次数:
312
描述:扔n个骰子,向上面的数字之和为 S 。给定 Given n,请列出所有可能的 S 值及其相应的概率。 样例:给定n=1,返回 [ [1, 0.17], [2, 0.17], [3, 0.17], [4, 0.17], [5, 0.17], [6, 0.17]] 解题思路:假定有n个骰子,那么可 ...
分类:
其他好文 时间:
2018-06-08 20:39:23
阅读次数:
178
Description Given an array and a value, remove all occurrences of that value in place and return the new length. The order of elements can be changed, ...
分类:
编程语言 时间:
2018-06-05 19:56:13
阅读次数:
178
原题网址:https://www.lintcode.com/problem/hash-function/description 描述 在数据结构中,哈希函数是用来将一个字符串(或任何其他类型)转化为小于哈希表大小且大于等于零的整数。一个好的哈希函数可以尽可能少地产生冲突。一种广泛使用的哈希函数算法是 ...
分类:
其他好文 时间:
2018-06-05 17:45:22
阅读次数:
188
原题网址:https://www.lintcode.com/problem/unique-paths/description 描述 有一个机器人的位于一个 m × n 个网格左上角。 机器人每一时刻只能向下或者向右移动一步。机器人试图达到网格的右下角。 问有多少条不同的路径? 描述 描述 有一个机器 ...
分类:
其他好文 时间:
2018-06-04 17:48:49
阅读次数:
164
原题网址:https://www.lintcode.com/problem/minimum-path-sum/description 描述 给定一个只含非负整数的m*n网格,找到一条从左上角到右下角的可以使数字和最小的路径。 描述 描述 给定一个只含非负整数的m*n网格,找到一条从左上角到右下角的可 ...
分类:
其他好文 时间:
2018-06-04 16:29:21
阅读次数:
246
原题网址:https://www.lintcode.com/problem/search-in-rotated-sorted-array-ii/description 描述 跟进“搜索旋转排序数组”,假如有重复元素又将如何? 是否会影响运行时间复杂度? 如何影响? 为何会影响? 写出一个函数判断给定 ...
分类:
编程语言 时间:
2018-06-02 21:28:09
阅读次数:
242
Description Merge two sorted (ascending) linked lists and return it as a new sorted list. The new sorted list should be made by splicing together the ...
分类:
编程语言 时间:
2018-06-02 13:31:31
阅读次数:
213
Description Write a method anagram(s,t) to decide if two strings are anagrams or not. Description Description Write a method anagram(s,t) to decide if ...
分类:
编程语言 时间:
2018-06-02 12:20:13
阅读次数:
160
原题网址:https://www.lintcode.com/problem/4sum/description 描述 给一个包含n个数的整数数组S,在S中找到所有使得和为给定整数target的四元组(a, b, c, d)。 描述 描述 给一个包含n个数的整数数组S,在S中找到所有使得和为给定整数ta ...
分类:
其他好文 时间:
2018-06-01 14:30:06
阅读次数:
151