You have two numbers represented by a linked list, where each node contains a single digit. The digits are stored in reverse order, such that the Ts d...
分类:
其他好文 时间:
2014-07-09 15:35:19
阅读次数:
176
Given an input string, reverse the string word by word.
分类:
其他好文 时间:
2014-07-08 22:41:34
阅读次数:
187
Evaluate the value of an arithmetic expression in Reverse Polish Notation.
分类:
其他好文 时间:
2014-07-08 22:28:14
阅读次数:
176
两种方法翻转一个整数,顺序翻转和递归翻转这里没考虑overflow的情况递归的作用是使得反向处理,即从递归栈的最低端开始处理,通过画图可得。如果是rec(num/10):123451234123121 package recursion;
public class Reverse_digits_of_a_number {
public static void main(Str...
分类:
其他好文 时间:
2014-07-08 18:34:14
阅读次数:
208
def reverse(head):
if head == None or head.next == None:
return head
psuhead = ListNode(-1)
while head:
nexthead = head.next
head.next = psuhead.next
psuhead.next = head
head = nexthead
...
分类:
其他好文 时间:
2014-07-08 15:27:58
阅读次数:
183
# @left part: [start, mid]
# @right part: (mid, end]
def merge(data, start, mid, end):
if mid < start or end < mid:
return 0
reverse = 0
'''
@ for start, it play as the start index of left par...
分类:
其他好文 时间:
2014-07-08 15:04:06
阅读次数:
204
明确递归语句之前的语句都是顺序执行,而递归语句之后的语句都是逆序执行package recursion;
import java.util.Stack;
public class Reverse_a_stack_using_recursion {
/*
Input stack:
3
2
1
Output stack:
1
2
3
*/
public s...
分类:
其他好文 时间:
2014-07-08 13:39:49
阅读次数:
143
You have two numbers represented by a linked list, where each node contains a single digit. The digits are stored in reverse order, such that the 1’s ...
分类:
其他好文 时间:
2014-07-08 13:34:40
阅读次数:
195
Given an input string, reverse the string word by word.For example,Given s = "the sky is blue",return "blue is sky the".click to show clarification.Cl...
分类:
其他好文 时间:
2014-07-08 10:26:31
阅读次数:
240
陆陆续续几个月下来,终于把题刷完了,过程中遇到的python的题解很少,这里重新用python实现下,所以题解可能都是总结性的,或者是新的心得,不会仅针对题目本身说的太详细。
def reverseWords(self, s):
s = ' '.join(s.split()[::-1])
return s
[ : : -1 ] 是将元素进行翻转...
分类:
编程语言 时间:
2014-07-06 00:37:50
阅读次数:
299