题目:Given a binary tree, return the zigzag level order traversal of its nodes' values. (ie, from left to right, then right to left for the next level ....
分类:
编程语言 时间:
2014-08-05 05:17:38
阅读次数:
311
题目原文:
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-08-05 00:51:58
阅读次数:
257
Given a binary tree, return the zigzag level order traversal of its nodes' values. (ie, from left to right, then right to left for the next level and ...
分类:
其他好文 时间:
2014-08-05 00:18:28
阅读次数:
225
题目:存在一个单链表,头指针为head,实现单链表的反转Node *Reverse(Node *head)。
该算法的求解办法有很多,如:
方法1:先顺序变量单链表,将结点保存到栈中,在从栈中弹出结点,重新建立一个新的单链表;
方法2:用《剑指offer》里面给出的算法,用三个指针来实现;
方法3:采用递归实现,是方法2的递归实现形式。
本文主要给出方法2和方法3,在给出具体的代码之前,先要注意几个问题:
...
分类:
其他好文 时间:
2014-08-04 18:01:57
阅读次数:
200
vars="Bestwishestoeveryone!";s=String.Concat(Regex.Matches(s,"\\w+|\\W+").Cast().Reverse().Select(m=>m.Value).ToArray());
分类:
其他好文 时间:
2014-08-04 13:34:17
阅读次数:
236
摘抄自《JavaScript权威指南》1.join()返回生成的字符串。数组元素转化为字符串,拼接。默认分隔符:“,”。2.reverse()返回逆序的数组,替换。数组中的元素倒序。3.sort()返回排序后的数组,替换。数组中的元素排序。无参数:按字母表排序,undefined元素尾部;参数为比较...
分类:
Web程序 时间:
2014-08-04 10:43:47
阅读次数:
228
Given a linked list and a value x, partition it such that all nodes less than x come before nodes greater than or equal to x.
You should preserve the original relative order of the nodes in each of...
分类:
其他好文 时间:
2014-08-03 23:28:56
阅读次数:
261
Problem FReverse PrimeInput:Standard InputOutput:Standard OutputThere are a few 7 digit positive numbers whose reverse number is a prime number and le...
分类:
其他好文 时间:
2014-08-03 23:07:36
阅读次数:
469
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-08-03 12:54:55
阅读次数:
201
Consider an infinite full binary search tree (see the figure below), the numbers in the nodes are 1, 2, 3, .... In a subtree whose root node is X, we can get the minimum number in this subtree by repe...
分类:
其他好文 时间:
2014-08-03 12:49:15
阅读次数:
229