题目: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-04-17 15:27:16
阅读次数:
100
点击打开链杭电1379
Problem Description
One measure of ``unsortedness'' in a sequence is the number of pairs of entries that are out of order with respect to each other. For instance, in the letter sequen...
分类:
编程语言 时间:
2015-04-16 21:58:10
阅读次数:
183
/** * ID: 24 * Name: Swap Nodes in Pairs * Data Structure: Linked List * Time Complexity: * Space Complexity: * Tag: LinkList * Difficult: Medium ...
分类:
其他好文 时间:
2015-04-14 07:10:45
阅读次数:
127
题目:
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:“((()))”, “(()())”, “(())()”, “()(())”, “()()()”...
分类:
其他好文 时间:
2015-04-13 20:54:32
阅读次数:
121
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 m...
分类:
其他好文 时间:
2015-04-13 12:58:22
阅读次数:
77
题目:
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...
分类:
其他好文 时间:
2015-04-12 19:23:23
阅读次数:
128
题目: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...
分类:
其他好文 时间:
2015-04-09 11:56:25
阅读次数:
148
题目:
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:
"((()))", "(()())", "(())()", "()(()...
分类:
其他好文 时间:
2015-04-07 11:58:50
阅读次数:
116
关键是想好swap 的function怎么写我的做法是输入输出两支点pre& end,中间的两个node swappublic class Solution { public ListNode swapPairs(ListNode head) { if(head==null ||...
分类:
其他好文 时间:
2015-04-07 07:10:45
阅读次数:
128
Implement analgorithm to print all valid combinations of n-pairs of parenthese.Analysis:-只要待加入的有左括号就可以加入左括号。最初可以加入的左括号为n个。-只要已加入的左括号比右括号多就可以加入右括号。最初可以...
分类:
其他好文 时间:
2015-04-03 14:46:24
阅读次数:
115