时间限制:10000ms 单点时限:1000ms 内存限制:256MB 描述 Given a string of balanced parentheses output all the matching pairs. 输入 A string consisting of only parenthese ...
分类:
其他好文 时间:
2017-01-12 09:56:37
阅读次数:
224
3Sum Given a integer array, find all the unique 3-number pairs which sum = 0. Solution O(N^2): 1. Sort the array, and makes this problem to a equal '2 ...
分类:
其他好文 时间:
2017-01-11 07:58:58
阅读次数:
188
Given n pairs of parentheses, write a function to generate all combinations of well-formed parentheses.For example, given n = 3, a solution set is:[ "... ...
分类:
其他好文 时间:
2017-01-04 23:30:35
阅读次数:
280
print pairs的结果为: 方法一: 方法二: 转自: http://stackoverflow.com/questions/18283725/how-to-create-a-python-dictionary-with-double-quotes-as-default-quote-forma ...
分类:
编程语言 时间:
2016-12-28 19:52:58
阅读次数:
153
Given a linked list, swap every two adjacent nodes and return its head. For example,Given 1->2->3->4, you should return the list as 2->1->4->3. Your a ...
分类:
其他好文 时间:
2016-12-24 14:08:21
阅读次数:
129
本题的特点在于两个list nums1和nums2都是已经排序好的。本题如果把所有的(i, j)组合都排序出来,再取其中最小的K个。其实靠后的很多组合根本用不到,所以效率较低,会导致算法超时。为了简便,把nums1和nums2里面的元素写成A1,A2,...,A5, B1,...,B5. 维护一个最 ...
分类:
其他好文 时间:
2016-12-22 06:47:17
阅读次数:
169
Given n pairs of parentheses, write a function to generate all combinations of well-formed parentheses. For example, given n = 3, a solution set is: c ...
分类:
其他好文 时间:
2016-12-21 23:34:48
阅读次数:
211
In short, we have some sort of algorithms to gen pair of private and public keys. The public key is stored in a certificate and the private key is usu ...
分类:
其他好文 时间:
2016-12-19 18:35:19
阅读次数:
184
#24. Swap Nodes in Pairs Given a linked list, swap every two adjacent nodes and return its head. For example, Given 1->2->3->4, you should return the ...
分类:
其他好文 时间:
2016-12-19 00:01:24
阅读次数:
359
我自己的backtracking做法 最开始把cur设置为一个dummy value 0 最好的DFS with Optimization beat 97%: https://discuss.leetcode.com/topic/46260/java-dfs-solution-with-clear- ...
分类:
移动开发 时间:
2016-12-16 07:49:21
阅读次数:
302