题目:
Given an input string, reverse the string word by word.
For example,
Given s = "the sky is blue",
return "blue is sky the".
思路:
方法1:首先把句子看做由词组成的,例如“A B C”,因此可以将句子的所有字符前后交换,得到“C...
分类:
其他好文 时间:
2014-08-25 22:53:04
阅读次数:
194
Reverse Integer
Total Accepted: 27372 Total
Submissions: 68133My Submissions
Reverse digits of an integer.
Example1: x = 123, return 321
Example2: x = -123, return -321
题目咋看起...
分类:
其他好文 时间:
2014-08-25 21:12:54
阅读次数:
198
$a="asdfghjklqwe"$b=$nullforeach ($_ in ("$a".length-1)..0){$b +=$a[$_]}$b$a="asdfghjklqwe"$b = $a.ToCharArray()[array]::Reverse($b)$b -join ''
分类:
其他好文 时间:
2014-08-25 16:47:54
阅读次数:
153
总结:其实就是反转链表。不过是反转中间一部分。要注意的是保存第一个结点的前继的指针; 若第一个结点是头结点,注意反转子串的尾结点变为头结点。
分类:
其他好文 时间:
2014-08-25 01:07:43
阅读次数:
198
Add Two Numbers
Total Accepted: 20255 Total
Submissions: 88115My Submissions
You are given two linked lists representing two non-negative numbers. The digits are stored in reverse order a...
分类:
其他好文 时间:
2014-08-23 21:40:01
阅读次数:
200
Example 1: Write a function to reverse a string.Example Java code: public static String reverse ( String s ) { int length = s.length(), last =length ....
分类:
其他好文 时间:
2014-08-22 19:42:59
阅读次数:
236
Evaluate Reverse Polish NotationEvaluate the value of an arithmetic expression inReverse Polish Notation.Valid operators are+,-,*,/. Each operand may ...
分类:
其他好文 时间:
2014-08-22 12:18:26
阅读次数:
135
Reverse Words in a StringGiven an input string, reverse the string word by word.For example,Given s = "the sky is blue",return "blue is sky the".Clari...
分类:
其他好文 时间:
2014-08-22 10:30:55
阅读次数:
109
Partition List
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...
分类:
其他好文 时间:
2014-08-21 19:23:34
阅读次数:
295
Reverse IntegerReverse digits of an integer.Example1:x = 123, return 321Example2:x = -123, return -321click to show spoilers.Have you thought about th...
分类:
其他好文 时间:
2014-08-21 19:07:04
阅读次数:
142