题目链接 Given a linked list, reverse the nodes of a linked list k at a time and return its modified list. If the number of nodes is not a multiple of k t...
分类:
其他好文 时间:
2014-06-28 21:12:46
阅读次数:
211
1- "原地"排序-转换后替换>>> list = [2,1,3]>>> list.sort()>>> list[1, 2, 3]降序 reverse = True>>> list.sort(reverse = True)>>> list[3, 2, 1, 1]2- "复制"排序-转换然后返回>>>...
分类:
编程语言 时间:
2014-06-28 20:04:47
阅读次数:
299
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 ...
分类:
其他好文 时间:
2014-06-28 14:31:12
阅读次数:
201
Reverse a linked list from positionmton. Do it in-place and in one-pass.For example:Given1->2->3->4->5->NULL,m= 2 andn= 4,return1->4->3->2->5->NULL.No...
分类:
其他好文 时间:
2014-06-28 13:23:40
阅读次数:
150
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 ...
分类:
其他好文 时间:
2014-06-28 10:45:34
阅读次数:
225
the coal industry may reverse its decline in 2014. Coal stockpiles have disappeared at a faster clip than at any time in the past decade due to cold w...
分类:
其他好文 时间:
2014-06-23 07:01:07
阅读次数:
235
题目描述Given a non-negative integer sequence A with length N, you can exchange two adjacent numbers each time. After K exchanging operations, what’s the ...
分类:
其他好文 时间:
2014-06-22 23:36:42
阅读次数:
232
Determine whether an integer is a palindrome. Do this without extra space.
思路:若使用【Leetcode】Reverse
Integer 的方法,判断反转后的整数是否与原整数相同,则可能出现溢出情况;又因为题目要求不适用额外空间,可以之间对比整数第一个与最后一个数的值,再依次类推。
class Solution {...
分类:
其他好文 时间:
2014-06-22 20:43:56
阅读次数:
187
Reverse digits of an integer.
Example1: x = 123, return 321
Example2: x = -123, return -321
Have you thought about this?
Here are some good questions to ask before coding. Bonus points for y...
分类:
其他好文 时间:
2014-06-22 09:31:16
阅读次数:
220
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...
分类:
其他好文 时间:
2014-06-21 15:20:39
阅读次数:
191