题目: 采用递归计算过程计算出帕斯卡三角形的各个元素。row:0 11 1 12 1 2 13 1 3 3 14 1 4 6 4 15 . . . . . .col: 0 1 2 3 4//c++//递归#includeusing namespace std;int pascaler(int row...
分类:
编程语言 时间:
2015-01-14 14:10:10
阅读次数:
177
题目:Given a singly linked list where elements are sorted in ascending order, convert it to a height balanced BST.代码:oj测试通过Runtime:178 ms 1 # Definition...
分类:
编程语言 时间:
2015-01-11 20:18:51
阅读次数:
235
题目:A linked list is given such that each node contains an additional random pointer which could point to any node in the list or null.Return a deep co...
分类:
编程语言 时间:
2015-01-11 17:39:30
阅读次数:
178
题目:Given a linked list and a valuex, partition it such that all nodes less thanxcome before nodes greater than or equal tox.You should preserve the or...
分类:
编程语言 时间:
2015-01-10 12:25:37
阅读次数:
204
题目:Given a linked list, swap every two adjacent nodes and return its head.For example,Given1->2->3->4, you should return the list as2->1->4->3.Your al...
分类:
编程语言 时间:
2015-01-10 00:57:36
阅读次数:
327
题目:Given a singly linked listL:L0→L1→…→Ln-1→Ln,reorder it to:L0→Ln→L1→Ln-1→L2→Ln-2→…You must do this in-place without altering the nodes' values.For e...
分类:
编程语言 时间:
2015-01-09 23:44:17
阅读次数:
237
题目:Reverse a linked list from positionmton. Do it in-place and in one-pass.For example:Given1->2->3->4->5->NULL,m= 2 andn= 4,return1->4->3->2->5->NULL...
分类:
编程语言 时间:
2015-01-09 00:09:55
阅读次数:
301
题目:Sort a linked list inO(nlogn) time using constant space complexity.代码:oj 测试通过Runtime:372 ms 1 # Definition for singly-linked list. 2 # class ListNo...
分类:
编程语言 时间:
2015-01-08 19:37:40
阅读次数:
195
题目:Sort a linked list using insertion sort.代码:oj测试通过Runtime:860 ms 1 # Definition for singly-linked list. 2 # class ListNode: 3 # def __init__(sel...
分类:
编程语言 时间:
2015-01-03 21:03:14
阅读次数:
208
题目:Given an input string, reverse the string word by word.For example,Given s = "the sky is blue",return "blue is sky the".代码:oj在线测试通过Runtime:172 ms 1...
分类:
编程语言 时间:
2014-12-27 01:26:47
阅读次数:
232