题目:2.2.2 Reverse Linked List IIReverse a linked list from position m to n. Do it in-place and in one-pass.For example:Given 1->2->3->4->5->nullptr, m = 2 and n = 4,return 1->4->3->2->5->nullptr.Note: ...
分类:
其他好文 时间:
2015-03-28 11:33:15
阅读次数:
154
题目分析:常规解法,实在不知道如何优化了。 1 class Solution { 2 public: 3 uint32_t reverseBits(uint32_t n) 4 { 5 uint32_t m = 0; 6 for (uint32_t i...
分类:
其他好文 时间:
2015-03-28 11:20:17
阅读次数:
101
1 题目:2.2.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 nodes contain a single digit. Add the two numbe...
分类:
其他好文 时间:
2015-03-28 08:48:00
阅读次数:
185
0. 新与旧两种reverse>>> L = [1,2,3,4]>>> R = L[::-1] # new object>>> R[4, 3, 2, 1]>>> L.reverse() # in place>>> L[4, 3, 2, 1]>>>两种sort>>> sorted(r) # new o...
分类:
编程语言 时间:
2015-03-28 06:20:12
阅读次数:
172
Reverse bits of a given 32 bits unsigned integer.For example, given input 43261596 (represented in binary as00000010100101000001111010011100), return ...
分类:
其他好文 时间:
2015-03-28 01:04:10
阅读次数:
151
写一个翻转函数,使字符串倒叙 先把整个句子翻转 然后以空格为split,分割字符串 对单个字符再进行翻转,然后重新组合 package reverseSentence42; public class ReverseSentence42 { static String reverse(String s...
分类:
其他好文 时间:
2015-03-27 21:53:43
阅读次数:
194
Reverse digits of an integer.Example1:x = 123, return 321Example2:x = -123, return -321click to show spoilers.Have you thought about this?Here are som...
分类:
其他好文 时间:
2015-03-22 06:49:21
阅读次数:
131
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-03-21 21:08:04
阅读次数:
177
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-03-21 19:53:11
阅读次数:
151
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 link...
分类:
其他好文 时间:
2015-03-21 15:39:18
阅读次数:
118