题目链接 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 t...
分类:
其他好文 时间:
2014-06-28 21:12:46
阅读次数:
211
1.无重复排列 2.有重复排列 3,下一个排列 package 生成排列;public class Main { static int count=0; //a中保存原来的排列,lev表示选定第几个数,len是长度 public static void swap(int a[],int lev,in...
分类:
编程语言 时间:
2014-06-28 21:04:53
阅读次数:
322
Reorder ListGiven 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' val...
分类:
其他好文 时间:
2014-06-28 20:42:16
阅读次数:
265
Merge two sorted linked lists and return it as a new list. The new list should be made by splicing together the nodes of the first two lists./** * Def...
分类:
其他好文 时间:
2014-06-21 07:55:42
阅读次数:
197
Given a binary tree, return thepreordertraversal of its nodes' values.For example:Given binary tree{1,#,2,3}, 1 \ 2 / 3return[1,2,3].Not...
分类:
其他好文 时间:
2014-06-21 06:40:07
阅读次数:
172
Given a binary tree, return thepostordertraversal of its nodes' values.For example:Given binary tree{1,#,2,3}, 1 \ 2 / 3return[3,2,1].No...
分类:
其他好文 时间:
2014-06-21 06:31:43
阅读次数:
265
题目
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 const...
分类:
其他好文 时间:
2014-06-18 11:53:39
阅读次数:
138
#import
//交换函数
void swap(int x, int y)
{
printf("x=%d,y=%d",x,y);
int temp = 0;
temp = x;
x = y;
y = temp;
printf("x=%d,y=%d",x,y);
}
//
void swap2(int *x , int *y)...
分类:
编程语言 时间:
2014-06-18 07:10:13
阅读次数:
302
You are given two linked lists representing two non-negative numbers. The digits are stored in reverse order and each of their nodes contain a single ...
分类:
其他好文 时间:
2014-06-17 23:38:04
阅读次数:
341
题目
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 rem...
分类:
其他好文 时间:
2014-06-17 22:15:52
阅读次数:
299