【题目】
Reverse a linked list from position m to n. Do it in-place and in one-pass.
For example:
Given 1->2->3->4->5->NULL, m = 2 and n = 4,
return 1->4->3->2->5->NULL.
Note:
Given m, n satisfy the following condition:
1 ≤ m ≤ n ≤ length of list.
【题意】
...
【题目】
Given a string containing only digits, restore it by returning all possible valid IP address combinations.
For example:
Given "25525511135",
return ["255.255.11.135", "255.255.111.35"]. (Order does not matter)
【题意】
给定一个字符串,恢复并返回所有符合条件的IP串
【思路】...
【题目】
Given a binary tree, return the inorder traversal of its nodes' values.
For example:
Given binary tree {1,#,2,3},
1
2
/
3
return [1,3,2].
Note: Recursive solution is trivial, could you do it iteratively?
confused what "{1,#,2...
TOJ 614173971
HDU 宇智波佐助
POJ shiai
ZOJ henyumen
UVa henyumen
Light OJ HENYUMEN...
【题目】
Given n, how many structurally unique BST's (binary search trees) that store values 1...n?
For example,
Given n = 3, there are a total of 5 unique BST's.
1 3 3 2 1
\ / / / \ 3 2 1 ...
【题目】
Given n, generate all structurally unique BST's (binary search trees) that store values 1...n.
For example,
Given n = 3, your program should return all 5 unique BST's shown below.
1 3 3 2 1
\ / / / \ ...
线性表
线性表分为链表和顺序表
链表按有无头结点分为有头结点链表和无头结点链表,按是否循环分为循环链表和非循环链表,按是否双向分为单向链表和双向链表
1。不带头结点非循环单链表
2.带头结点非循环单链表(头结点的值域是没有意义的)
3.不带头结点循环单链表
4.带头结点循环单链表(尾节点的下一个节点指向第一个值域有意义的节点)
5.不带头结点非循环双向...
74LS183
搭的一个还有点意思的加法电路,串行进位的
2+6 == 8 大家都懂的哈哈...
前言:
以上涉及的各种背包问题都是要求在背包容量(费用)的限制下求可以取到的最大价值,但背包问题还有很多种灵活的问法,在这里值得提一下。但是我认为,只要深入理解了求背包问题最大价值的方法,即使问法变化了,也是不难想出算法的。例如,求解最多可以放多少件物品或者最多可以装满多少背包的空间。这都可以根据具体问题利用前面的方程求出所有状态的值(f数组)之后得到。还有,如果要求的是“总价值...