- 博客(3)
- 收藏
- 关注
原创 LeetCode 323. Number of Connected Components in an Undirected Graph
LeetCode 323. Number of Connected Components in an Undirected Graph原题链接:https://leetcode.com/problems/number-of-connected-components-in-an-undirected-graph/并查集做法。开辟一个数组保存他的parent。为了方便设了一个set保存
2016-10-02 01:50:11
468
原创 LeetCode 357. Count Numbers with Unique Digits
LeetCode 357. Count Numbers with Unique Digits原题链接:https://leetcode.com/problems/count-numbers-with-unique-digits/简单题。总结出数学规律就好了。算n位数中有多少个数由unique digit构成。Count(n) = 9 *9 * 8 *...(11-n).pu
2016-10-02 01:38:15
177
原创 LeetCode 375. Guess Number Higher or Lower II
原题链接: https://leetcode.com/problems/guess-number-higher-or-lower-ii/Minimax思想。利用DP。Dp[i][j]表示在[i,j]范围内保证能赢的钱数。在[1, n]的范围中,我取一个数k,这样就被分为了[1, k-1], [k],[k+1, n]这三段。由于事先并不知道target坐落在哪个范围,既然要保证能赢,那么取Max
2016-10-02 01:20:58
260
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人