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-02-15 10:52:45
阅读次数:
156
好吧这其实是一次小比赛,在回上海前的周末。好久没打比赛,简单题也只是AK了而已,还TM错了一次。最后45名57分钟加一次罚时,第一名18分钟,好吧。也行了对于业余组选手。 错在没考虑到乘2会超max_int。 程序没了,也没心情找了。孤单的情人节。 貌似有两个人被发现作弊了我变成了43名,还找到了程 ...
分类:
其他好文 时间:
2017-02-14 20:25:47
阅读次数:
126
案例一: do local a ={} a[1] = {11} a[2] = {22} for k, v in pairs(a) do if 2 == k then print(v) v = nil end end print(a[2]) local b = a[2] print(b) b = ni ...
分类:
其他好文 时间:
2017-02-12 12:41:05
阅读次数:
140
原题链接在这里:https://leetcode.com/problems/find-k-pairs-with-smallest-sums/ 题目: You are given two integer arrays nums1 and nums2 sorted in ascending order ...
分类:
其他好文 时间:
2017-02-02 17:22:31
阅读次数:
171
There are N beads which of the same shape and size, but with different weights. N is an odd number and the beads are labeled as 1, 2, ..., N. Your tas ...
分类:
其他好文 时间:
2017-01-25 14:29:35
阅读次数:
173
Given a graph G(V, E), a clique is a sub-graph g(v, e), so that for all vertex pairs v1, v2 in v, there exists an edge (v1, v2) in e. Maximum clique i ...
分类:
其他好文 时间:
2017-01-24 20:12:21
阅读次数:
222
t = { [1] = 222, [2] = 23, [3] = 2433, [4] = 135, } t1 = { 222, 23, 2433, 135, } t2 = { 'a', 'b','d','c', } function cmp(v1, v2) return v1.key < v2.ke... ...
分类:
编程语言 时间:
2017-01-18 12:27:48
阅读次数:
183
题意:给你一个正整数n,问你存在多少个正整数对a,b(a<b),满足条件:存在正整数x,y,使得ax+by=n。 就预处理出n以内所有数的约数,然后暴力枚举a,暴力枚举x,然后枚举n-ax的所有约数,判重,统计答案即可。 ...
分类:
其他好文 时间:
2017-01-18 07:57:03
阅读次数:
254
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-15 20:32:27
阅读次数:
232
Pairs(对组) 1、class pair可以将两个值视为一个单元,C++标准程序库内多处使用这个class。尤其容器类别map和multimap,就是使用pairs来管理其键值/实值(key/value)的成对元素。任何函数需要返回两个值,都需要pairs ...
分类:
编程语言 时间:
2017-01-15 20:31:09
阅读次数:
190