Given a linked list, reverse the nodes of a linked listkat a time and return its modified list.If the number of nodes is not a multiple ofkthen left-o...
分类:
其他好文 时间:
2014-10-26 15:30:30
阅读次数:
159
【题目】
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 digit. Add the two numbers and return it...
分类:
其他好文 时间:
2014-10-26 14:21:29
阅读次数:
243
有两个变量 a 和 b ,交换这两个变量的值方法一 使用中间变量void swap(int *a, int *b){ int temp = 0; temp = *a; *a = *b; *b = temp; }方法二 不适用任何中间变量 ① 异或运算法void swap...
分类:
其他好文 时间:
2014-10-26 13:05:02
阅读次数:
149
Given a binary tree, find its maximum depth.The maximum depth is the number of nodes along the longest path from the root node down to the farthest le...
分类:
其他好文 时间:
2014-10-26 07:58:51
阅读次数:
161
Given a binary tree, return thelevel ordertraversal of its nodes' values. (ie, from left to right, level by level).For example:Given binary tree{3,9,2...
分类:
其他好文 时间:
2014-10-26 06:48:34
阅读次数:
188
Given a binary tree, return thebottom-up level ordertraversal of its nodes' values. (ie, from left to right, level by level from leaf to root).For exa...
分类:
其他好文 时间:
2014-10-26 06:47:17
阅读次数:
187
题目:
Given two binary trees, write a function to check if they are equal or not.
Two binary trees are considered equal if they are structurally identical and the nodes have the same value....
分类:
其他好文 时间:
2014-10-25 23:09:06
阅读次数:
447
题目
Given a binary tree, find its maximum depth.
The maximum depth is the number of nodes along the longest path from the root node down to the farthest leaf node....
分类:
其他好文 时间:
2014-10-25 18:50:01
阅读次数:
137
贴段代码先 1 void c_swap(int *a, int *b) 2 { 3 *a = *a ^ *b; 4 *b = *a ^ *b; 5 *a = *a ^ *b; 6 } 7 8 void swap(int &a, int &b) 9 {10 a = a...
分类:
编程语言 时间:
2014-10-25 18:42:06
阅读次数:
174
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 origi...
分类:
其他好文 时间:
2014-10-25 15:47:52
阅读次数:
225