上一页 1 ··· 12 13 14 15 16 17 18 19 20 ··· 23 下一页
摘要: http://blog.csdn.net/linhuanmars/article/details/20828631这个题是一个NP问题,方法仍然是N-Queens中介绍的套路。基本思路是先排好序,然后每次递归中把剩下的元素一一加到结果集合中,并且把目标减去加入的元素,然后把剩下元素(包括当前加入的元... 阅读全文
posted @ 2014-10-18 00:19 Ryan in C++ 阅读(183) 评论(0) 推荐(0)
摘要: http://changhaz.wordpress.com/2014/10/15/leetcode-find-minimum-in-rotated-sorted-array/Suppose a sorted array is rotated at some pivot unknown to you ... 阅读全文
posted @ 2014-10-17 23:20 Ryan in C++ 阅读(327) 评论(0) 推荐(0)
摘要: 1 #include 2 #include 3 #include 4 #include 5 using namespace std; 6 7 class Solution { 8 public: 9 string getPermutation(int n, int k) {10 ... 阅读全文
posted @ 2014-10-17 19:45 Ryan in C++ 阅读(240) 评论(0) 推荐(0)
摘要: EdgeCase太容易出错。有两处都是应该为 2 #include 3 #include 4 using namespace std; 5 6 class Solution2 { 7 public: 8 void nextPermutation(vector &num) { 9 ... 阅读全文
posted @ 2014-10-17 11:11 Ryan in C++ 阅读(522) 评论(0) 推荐(0)
摘要: LeetCode:SubsetsGiven a set of distinct integers,S, return all possible subsets.Note:Elements in a subset must be in non-descending order.The solution... 阅读全文
posted @ 2014-10-17 08:10 Ryan in C++ 阅读(230) 评论(0) 推荐(0)
摘要: http://www.cnblogs.com/remlostime/archive/2012/11/14/2770072.html 1 class Solution { 2 private: 3 vector ret; 4 int pos[4]; 5 public: 6 bo... 阅读全文
posted @ 2014-10-15 16:53 Ryan in C++ 阅读(321) 评论(0) 推荐(0)
摘要: http://yucoding.blogspot.com/2013/08/leetcode-question-132-palindrome.htmlAnalysis:When face the "return all", "get all ", "find all possible", "find ... 阅读全文
posted @ 2014-10-14 23:38 Ryan in C++ 阅读(214) 评论(0) 推荐(0)
摘要: code: 1 #include 2 #include 3 #include 4 #include 5 using namespace std; 6 7 class Solution { 8 public: 9 int largestRectangleArea(vector &he... 阅读全文
posted @ 2014-10-13 18:59 Ryan in C++ 阅读(219) 评论(0) 推荐(0)
摘要: http://www.cnblogs.com/lichen782/p/leetcode_maximal_rectangle.html题目:Given a 2D binary matrix filled with 0's and 1's, find the largest rectangle cont... 阅读全文
posted @ 2014-10-13 16:52 Ryan in C++ 阅读(329) 评论(0) 推荐(0)
摘要: 1 #include 2 #include 3 #include 4 #include 5 using namespace std; 6 7 class Solution2 8 { 9 public:10 int largestRectangleArea(vector &heig... 阅读全文
posted @ 2014-10-12 22:28 Ryan in C++ 阅读(198) 评论(0) 推荐(0)
上一页 1 ··· 12 13 14 15 16 17 18 19 20 ··· 23 下一页