- 博客(12)
- 收藏
- 关注
原创 LeetCode - 121. Best Time to Buy and Sell Stock -思路详解
原题 给定一组股票交易的价格序列,第i个表示第i天的价格。只允许一次交易。
2016-11-22 21:03:12 607
原创 11. Container With Most Water--思路详解
题目: 给定n个非负整数a1,a2,..., an,每一个整数表示一点在(i,ai)的点。然后垂直于x轴向下划线。然后求线(i,ai)和(j,aj)还有x轴所能容纳最大的水量
2016-11-16 23:26:47 258
原创 162. Find Peak Element -- 思路详解
题目 找到数组中的峰值,假定输入中num[i] != num[i+1]。数组中可能含有多个峰值,只需要求出一个即可。可以想象num[-1]和num[n]为负无穷。
2016-11-16 23:07:03 603
原创 313. Super Ugly Number - 思路详解
题目Write a program to find the nth super ugly number.Super ugly numbers are positive numbers whose all prime factors are in the given prime list primes of size k.
2016-11-16 22:55:55 436
原创 264. Ugly Number II-思路详解
题目Write a program to find the n-th ugly number.Ugly numbers are positive numbers whose prime factors only include 2, 3, 5.
2016-11-16 22:50:58 504
原创 CFF-有趣的数-详解
题目我们把一个数称为有趣的,当且仅当: 1. 它的数字只包含0, 1, 2, 3,且这四个数字都出现过至少一次。 2. 所有的0都出现在所有的1之前,而所有的2都出现在所有的3之前。 3. 最高位数字不为0。
2016-11-14 09:58:08 775
原创 357. Count Numbers with Unique Digits
题目Given a non-negative integer n, count all numbers with unique digits, x, where 0 ≤ x < 10n. 分析题目要求计算x (0 <= x <= 10^n)中,包含的所有使用独一无二数字组成的数字的个数。设f(k)表示长度为k个数字中包含独一无二数字的个数。
2016-11-10 10:50:15 353
原创 116. Populating Next Right Pointers in Each Node
题目要求,将叶子结点的next指向它的右边的结点。如果右边结点不存在,则为NULL.
2016-11-09 18:23:50 467
原创 341. Flatten Nested List Iterator
原题:Given a nested list of integers, implement an iterator to flatten it. Each element is either an integer, or a list – whose elements may also be integers or other lists. 递归法求解 C++
2016-11-09 16:57:37 303
原创 69. Sqrt(x)
题目 Implement int sqrt(int x). Compute and return the square root of x. 分析 题目要求实现一个开放函数,返回一个数的开方根思路采用二分法。
2016-11-09 16:08:06 282
原创 367. Valid Perfect Square
Given a positive integer num, write a function which returns True if num is a perfect square else False.Note: Do not use any built-in library function such as sqrt. 题目分析该题要求,在不适用sqrt的情况下,求出一个整数是否是完全可开
2016-11-09 15:44:23 334
原创 96. Unique Binary Search Trees
Given n, how many structurally unique BST's (binary search trees) that store values 1...n? For example, Given n = 3, there are a total of 5 unique BST's. 1 3 3 2 1 \
2016-11-05 19:08:24 251
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人