题目:Reverse digits of an integer.Example1:x = 123, return 321Example2:x = -123, return -321Have you thought about this?Here are some good questions to ...
分类:
其他好文 时间:
2015-04-05 21:47:56
阅读次数:
145
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-04-05 18:53:07
阅读次数:
110
一:Reverse Integer
题目:
Reverse digits of an integer.
Example1: x = 123, return 321
Example2: x = -123, return -321
链接:https://leetcode.com/problems/reverse-integer/
分析:这题通过不断取余将余数存放在一个vecto...
分类:
其他好文 时间:
2015-04-05 14:40:31
阅读次数:
161
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...
分类:
其他好文 时间:
2015-04-05 11:54:52
阅读次数:
128
题目:Given a constant K and a singly linked list L, you are supposed to reverse the links of every K elements on L. For example, given L being 1→2→3→4→5...
分类:
其他好文 时间:
2015-04-05 11:50:33
阅读次数:
135
题目:
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 ...
分类:
其他好文 时间:
2015-04-04 21:16:34
阅读次数:
139
题目:
Reverse a linked list from position m to n.
Do it in-place and in one-pass.
For example:
Given 1->2->3->4->5->NULL, m =
2 and n = 4,
return 1->4->3->2->5->NULL.
Note:
Given m, ...
分类:
其他好文 时间:
2015-04-04 12:20:09
阅读次数:
138
Reverse bits of a given 32 bits unsigned integer.For example, given input 43261596 (represented in binary as00000010100101000001111010011100), return ...
分类:
其他好文 时间:
2015-04-03 19:11:16
阅读次数:
86
??
问题描述:
Reverse digitsof an integer.
Example1: x =123, return 321
Example2: x =-123, return -321
问题分析:反转算法并不难,关键在于对溢出问题的考虑
代码:
public class Solution {
public int reverse(int x) {...
分类:
其他好文 时间:
2015-04-03 17:21:30
阅读次数:
84
Node Reverse(Node head){
if(head == NULL)
return head;
Node pre,cur,ne;
pre = head;
cur = head->next;//当前要逆转结点
while(cur){
ne = cur->next;
cur->next = pre;
...
分类:
其他好文 时间:
2015-04-03 11:24:30
阅读次数:
100