Labyrinth
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 519 Accepted Submission(s): 174
Problem Description
度度熊是一只喜欢探险的熊,一次偶然落...
分类:
其他好文 时间:
2014-05-18 16:04:51
阅读次数:
304
一直想学学LISP,今天总算开了个头。现在我学习LISP不是为了马上能够用于实际项目的应用,而是为了学习一下函数式的思维方式,能够更加深入的了解计算的本质,能够更好的用C++, Java, Python等编写程序。更何况,这些主流语言都逐渐增加了函数式编程的特征,C++,Java现在都引入了 Lambda 表达式。如果能够系统学习一下LISP,相信对自己以后掌握这些语言的新特新特征,对自己写JavaScript、Python,对自己了解闭包、高阶函数、Lambda表达式都会有很大帮助。言归正传,首先推荐三个...
分类:
其他好文 时间:
2014-05-18 16:01:45
阅读次数:
530
题目:
链接:点击打开链接
算法:
完全背包。
状态转移方程: dp[j] += dp[j-i];dp[j]表示钱j可以兑换的方法,,,,,i是硬币的价值1,2,3,,,个数是不限的
代码:
#include
#include
#include
using namespace std;
int dp[40000];
int n;
int main(...
分类:
其他好文 时间:
2014-05-18 15:43:08
阅读次数:
265
字符串
基本字符串操作
字符串也是序列,因此序列的基本操作(索引、分片、连接、乘法、长度、求最大值和最小值、成员资格)对字符串同样适用:
索引
>>> 'a_string'[0]
'a'
长度
>>> len('a_string')
8
求最大值
>>> max('a_string')
't'
求最小值
>>> min('a_string')
'_'
乘法
>>> ...
分类:
编程语言 时间:
2014-05-18 10:50:15
阅读次数:
325
【题目】
Given a linked list, reverse the nodes of a linked list k at a time and return its modified list.
If the number of nodes is not a multiple of k then left-out nodes in the end should remain as it is.
You may not alter the values in the nodes, only n...
分类:
其他好文 时间:
2014-05-18 10:22:34
阅读次数:
367
【题目】
Merge k sorted linked lists and return it as one sorted list. Analyze and describe its complexity.
【题意】
合并K个有序链表
【思路】
归并
Given n pairs of parentheses, write a function to generate all combinations of well-formed parentheses.
For ...
分类:
其他好文 时间:
2014-05-18 09:05:40
阅读次数:
255
【题目】
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 algorithm should use only constant space. You may not modify the values in the list, only nodes it...
分类:
其他好文 时间:
2014-05-18 08:37:57
阅读次数:
370
Lambda挺强大,有兴趣的人看下关于lambda的理论,就清楚邱奇编码的实现了。
带if/else:
( lambda x, y: x if x
科里化:
( lambda x: ( lambda y: ( lambda z: x + y + z )( 1 ) )( 2 ) )( 3 )
递归:
func = lambda n: 1 if n == 0 e...
分类:
编程语言 时间:
2014-05-18 03:48:34
阅读次数:
262
1、
??
Path Sum
Given a binary tree and a sum, determine if the tree has a root-to-leaf path such that adding up all the values along the path equals the given sum.
For example:
Given the below...
分类:
其他好文 时间:
2014-05-18 03:25:06
阅读次数:
301