上一页 1 2 3 4 5 6 7 ··· 20 下一页
摘要: Problem Description:Given an unsorted arraynums, reorder itin-placesuch thatnums[0] = nums[2] = nums[i - 1];Ifiis even, thennums[i] & nums) {4 ... 阅读全文
posted @ 2015-09-10 12:57 jianchao-li 阅读(2463) 评论(0) 推荐(0) 编辑
摘要: Well, after seeing the similar problems, you may have known how to solve this problem. Yeah, just to construct larger numbers from smaller numbers by ... 阅读全文
posted @ 2015-09-09 22:47 jianchao-li 阅读(593) 评论(0) 推荐(0) 编辑
摘要: This post shares a nice explanation, which is implemented here. The code is rewritten below. 1 class Solution { 2 public: 3 string minWindow(strin... 阅读全文
posted @ 2015-09-08 18:42 jianchao-li 阅读(206) 评论(0) 推荐(0) 编辑
摘要: This problem is relatively easy. The challenge is how to get a concise code. This post shares a very elegant one which traverses each cell of board on... 阅读全文
posted @ 2015-09-08 17:51 jianchao-li 阅读(224) 评论(0) 推荐(0) 编辑
摘要: Just don't be scared by this problem :-) It's also very standard backtracking problem. This post shares a very concise code, which is rewritten below ... 阅读全文
posted @ 2015-09-08 17:35 jianchao-li 阅读(218) 评论(0) 推荐(0) 编辑
摘要: Just use binary search to find the first bad version.The code is as follows. 1 // Forward declaration of isBadVersion API. 2 bool isBadVersion(int ver... 阅读全文
posted @ 2015-09-07 21:52 jianchao-li 阅读(177) 评论(0) 推荐(0) 编辑
摘要: Problem Description: Suppose you are at a party with n people (labeled from 0 to n - 1) and among them, there may exist one celebrity. The definition 阅读全文
posted @ 2015-09-06 22:43 jianchao-li 阅读(1273) 评论(0) 推荐(0) 编辑
摘要: Problem Description:There is a fence with n posts, each post can be painted with one of the k colors.You have to paint all the posts such that no more... 阅读全文
posted @ 2015-09-05 12:24 jianchao-li 阅读(4181) 评论(0) 推荐(1) 编辑
摘要: This problem is designed specifically to use binary search. In fact, in H-Index, someone has already used this idea (you may refer to this post :-))Th... 阅读全文
posted @ 2015-09-04 22:19 jianchao-li 阅读(251) 评论(0) 推荐(0) 编辑
摘要: If you've read the Wikipedia article of H-Index, there is already a neat formula there for computing the h-index, which is written below using the not... 阅读全文
posted @ 2015-09-04 22:15 jianchao-li 阅读(394) 评论(0) 推荐(0) 编辑
摘要: This link shares a nice solution with explanation using DP. You will be clear of the algorithm after running it on its suggested example:matrix = [[0,... 阅读全文
posted @ 2015-09-02 12:18 jianchao-li 阅读(217) 评论(0) 推荐(0) 编辑
摘要: The basic idea is as follows:Create anew_headthat points toheadand use it to locate the immediate node before them-th (notice that it is1-indexed) nod... 阅读全文
posted @ 2015-09-01 23:55 jianchao-li 阅读(154) 评论(0) 推荐(0) 编辑
摘要: This link has a very neat code, which is rewritten below using stacksince thepushandpopoperations of it areO(1)time, while thepop_backandpush_backofve... 阅读全文
posted @ 2015-09-01 21:20 jianchao-li 阅读(203) 评论(0) 推荐(0) 编辑
摘要: This problem is not difficult. But it is not easy to have a bug-free code. As you write your codes according to the hints, the most important thing is... 阅读全文
posted @ 2015-08-31 20:52 jianchao-li 阅读(678) 评论(0) 推荐(0) 编辑
摘要: Problem Description:Given a non-empty binary search tree and a target value, findkvalues in the BST that are closest to the target.Note:Given target v... 阅读全文
posted @ 2015-08-30 18:50 jianchao-li 阅读(4104) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 7 ··· 20 下一页