摘要: 原题地址:https://oj.leetcode.com/problems/pascals-triangle-ii/题意:Given an indexk, return thekthrow of the Pascal's triangle.For example, givenk= 3,Return[... 阅读全文
posted @ 2014-06-03 20:06 南郭子綦 阅读(2063) 评论(0) 推荐(0) 编辑
摘要: 原题地址:https://oj.leetcode.com/problems/pascals-triangle/题意:GivennumRows, generate the firstnumRowsof Pascal's triangle.For example, givennumRows= 5,Ret... 阅读全文
posted @ 2014-06-03 19:49 南郭子綦 阅读(2583) 评论(0) 推荐(0) 编辑
摘要: 原题地址:https://oj.leetcode.com/problems/triangle/题意:Given a triangle, find the minimum path sum from top to bottom. Each step you may move to adjacent n... 阅读全文
posted @ 2014-06-03 19:36 南郭子綦 阅读(2863) 评论(0) 推荐(0) 编辑
摘要: 算法导论上面快速排序的实现。代码:def partition(array, left, right): i = left-1 for j in range(left, right): if array[j] <= array[right]: i += ... 阅读全文
posted @ 2014-06-03 18:17 南郭子綦 阅读(1293) 评论(0) 推荐(0) 编辑
摘要: 原题地址:https://oj.leetcode.com/problems/best-time-to-buy-and-sell-stock-iii/题意:Say you have an array for which theithelement is the price of a given sto... 阅读全文
posted @ 2014-06-03 17:24 南郭子綦 阅读(3550) 评论(1) 推荐(0) 编辑
摘要: 原题地址:https://oj.leetcode.com/problems/best-time-to-buy-and-sell-stock-ii/题意:Say you have an array for which theithelement is the price of a given stoc... 阅读全文
posted @ 2014-06-03 16:15 南郭子綦 阅读(3546) 评论(0) 推荐(0) 编辑
摘要: 原题地址:https://oj.leetcode.com/problems/best-time-to-buy-and-sell-stock/题意:Say you have an array for which theithelement is the price of a given stock o... 阅读全文
posted @ 2014-06-03 15:59 南郭子綦 阅读(4924) 评论(0) 推荐(0) 编辑
摘要: 原题地址:https://oj.leetcode.com/problems/valid-palindrome/题意:Given a string, determine if it is a palindrome, considering only alphanumeric characters an... 阅读全文
posted @ 2014-06-03 15:39 南郭子綦 阅读(3518) 评论(0) 推荐(0) 编辑
摘要: 原题地址:https://oj.leetcode.com/problems/word-ladder/题意:Given two words (startandend), and a dictionary, find the length of shortest transformation seque... 阅读全文
posted @ 2014-06-03 15:28 南郭子綦 阅读(6400) 评论(2) 推荐(0) 编辑
摘要: 原题地址:https://oj.leetcode.com/problems/longest-consecutive-sequence/题意:Given an unsorted array of integers, find the length of the longest consecutive ... 阅读全文
posted @ 2014-06-03 12:51 南郭子綦 阅读(3907) 评论(0) 推荐(0) 编辑
摘要: 原题地址:https://oj.leetcode.com/problems/surrounded-regions/题意:Given a 2D board containing'X'and'O', capture all regions surrounded by'X'.A region is cap... 阅读全文
posted @ 2014-06-03 11:35 南郭子綦 阅读(4046) 评论(1) 推荐(0) 编辑