Reverse a singly linked list.思路:to slove this problem, I choose a recurrent method, to reverse linked-list nodes one-by-one.first, point head to NULL....
分类:
其他好文 时间:
2015-06-09 00:38:25
阅读次数:
116
Description
Given a sequence, {A1, A2, ..., An} which is guaranteed A1 > A2, ..., An, you are to cut it into three sub-sequences and reverse them
separately to form a new one which is the smalle...
分类:
编程语言 时间:
2015-06-08 21:40:56
阅读次数:
290
1. 题目Add Two NumbersYou are given two linked lists representing two non-negative numbers. The digits are stored in reverse order and each of their nod...
分类:
其他好文 时间:
2015-06-08 19:18:28
阅读次数:
173
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 as a linke...
分类:
其他好文 时间:
2015-06-08 15:05:57
阅读次数:
91
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 ...
分类:
其他好文 时间:
2015-06-08 12:57:49
阅读次数:
163
Reverse Nodes in k-GroupGiven 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...
分类:
其他好文 时间:
2015-06-08 09:36:33
阅读次数:
111
Given an input string, reverse the string word by word.For example,Given s = "the sky is blue",return "blue is sky the".Update (2015-02-12):For C prog...
分类:
其他好文 时间:
2015-06-08 08:23:40
阅读次数:
109
注:此分类仅供大概参考,没有精雕细琢。有不同意见欢迎评论~利用堆栈:http://oj.leetcode.com/problems/evaluate-reverse-polish-notation/http://oj.leetcode.com/problems/longest-valid-paren...
分类:
其他好文 时间:
2015-06-08 08:23:23
阅读次数:
119
1 class Solution { 2 public: 3 ListNode* reverseList(ListNode* head) { 4 if(head==NULL) 5 return head; 6 ListNode* pr...
分类:
其他好文 时间:
2015-06-07 21:25:26
阅读次数:
130
Reverse a singly linked list.解题思路:用Stack实现,JAVA实现如下: public ListNode reverseList(ListNode head) { if(head==null) return null; St...
分类:
编程语言 时间:
2015-06-07 20:15:41
阅读次数:
180