- 博客(6)
- 收藏
- 关注
原创 [leetcode] 287.Find the Duplicate Number
题目: Given an array nums containing n + 1 integers where each integer is between 1 and n (inclusive), prove that at least one duplicate element must exist. Assume that there is only one duplicate numbe
2015-09-28 13:25:09 1243 1
原创 [leetcode] 275.H-Index II
题目: Follow up for H-Index: What if the citations array is sorted in ascending order? Could you optimize your algorithm? 题意: 这道题目是接274题而来,不过这次的引用次数是按照升序排列的。 思路: 可以使用二分查找的方法进行,扫描到middle元素的时候,如果middl
2015-09-05 17:00:53 959
原创 [leetcode] 274.H-Index
题目: Given an array of citations (each citation is a non-negative integer) of a researcher, write a function to compute the researcher’s h-index.According to the definition of h-index on Wikipedia: “A
2015-09-05 16:58:02 1978
原创 [leetcode] 174.Dungeon Game
题目: The demons had captured the princess (P) and imprisoned her in the bottom-right corner of a dungeon. The dungeon consists of M x N rooms laid out in a 2D grid. Our valiant knight (K) was initially
2015-09-01 15:20:55 439
原创 [leetcode] 140.Word Break II
题目: Given a string s and a dictionary of words dict, add spaces in s to construct a sentence where each word is a valid dictionary word.Return all such possible sentences.For example, given s = “cats
2015-09-01 14:03:34 369
原创 [leetcode] 139.Word Break
题目: Given a string s and a dictionary of words dict, determine if s can be segmented into a space-separated sequence of one or more dictionary words.For example, given s = “leetcode”, dict = [“leet”
2015-09-01 13:23:00 368
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人