2014年9月30日

[leetcode] Scramble String @python

摘要: Given a strings1, we may represent it as a binary tree by partitioning it to two non-empty substrings recursively.Below is one possible representation... 阅读全文

posted @ 2014-09-30 00:06 AIDasr 阅读(425) 评论(0) 推荐(0) 编辑

2014年9月29日

[leetcode]Symmetric Tree @ Python

摘要: 原题地址:https://oj.leetcode.com/problems/symmetric-tree/题意:判断二叉树是否为对称的。Given a binary tree, check whether it is a mirror of itself (ie, symmetric around ... 阅读全文

posted @ 2014-09-29 02:08 AIDasr 阅读(863) 评论(0) 推荐(1) 编辑

2014年9月27日

[leetcode] Maximum Product Subarray @ python

摘要: [leetcode] Latest added:2014-09-23Find the contiguous subarray within an array (containing at least one number) which has the largest product.For exam... 阅读全文

posted @ 2014-09-27 22:33 AIDasr 阅读(446) 评论(0) 推荐(0) 编辑

2014年9月24日

[leetcode]Surrounded Regions @ Python

摘要: 原题地址: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-09-24 10:40 AIDasr 阅读(229) 评论(0) 推荐(0) 编辑

2014年9月21日

[leetcode]N-Queens @ Python

摘要: 原题地址:https://oj.leetcode.com/problems/n-queens/题意:经典的N皇后问题。解题思路:这类型问题统称为递归回溯问题,也可以叫做对决策树的深度优先搜索(dfs)。N皇后问题有个技巧的关键在于棋盘的表示方法,这里使用一个数组就可以表达了。比如board=[1, ... 阅读全文

posted @ 2014-09-21 10:45 AIDasr 阅读(411) 评论(0) 推荐(0) 编辑

2014年9月20日

[leetcode] Combinations @ Python [ask for help]

摘要: https://oj.leetcode.com/problems/combinations/Given two integers n and k, return all possible combinations of k numbers out of 1 ... n.For example,If ... 阅读全文

posted @ 2014-09-20 09:16 AIDasr 阅读(132) 评论(0) 推荐(0) 编辑

[leetcode]Next Permutation @ Python

摘要: 原题地址:https://oj.leetcode.com/problems/next-permutation/题意:Implement next permutation, which rearranges numbers into the lexicographically next greater... 阅读全文

posted @ 2014-09-20 06:57 AIDasr 阅读(548) 评论(0) 推荐(0) 编辑

2014年9月18日

[building block] merge sort @ Python

摘要: Here is the basic algorithm about merge sort:def merge(s1,s2,s): i=j=0 while i + j 0 and A[j-1] > cur: # element A[j-1] must be after current ... 阅读全文

posted @ 2014-09-18 10:28 AIDasr 阅读(338) 评论(0) 推荐(0) 编辑

2014年9月17日

[leetcode] Integer to Roman @ Python

摘要: 题目: https://oj.leetcode.com/problems/integer-to-roman/Given an integer, convert it to a roman numeral.Input is guaranteed to be within the range from ... 阅读全文

posted @ 2014-09-17 06:40 AIDasr 阅读(154) 评论(0) 推荐(0) 编辑

[leetcode] Roman to Integer @ Python

摘要: 题目:https://oj.leetcode.com/problems/roman-to-integer/Given a roman numeral, convert it to an integer.Input is guaranteed to be within the range from 1... 阅读全文

posted @ 2014-09-17 06:37 AIDasr 阅读(324) 评论(0) 推荐(0) 编辑

导航