问题:翻转数字分析:注意初始化class Solution {public: int reverse(int x) { int y=0; while(x) { y=(y*10)+x%10; x/=10; ...
分类:
其他好文 时间:
2014-08-01 22:32:12
阅读次数:
174
Reverse NumberTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 5052Accepted Submission(s): 2352Prob...
分类:
其他好文 时间:
2014-08-01 19:28:02
阅读次数:
301
Reverse TextTime Limit: 2 Seconds Memory Limit: 65536 KBIn most languages, text is written from left to right. However, there are other languages whe....
分类:
其他好文 时间:
2014-08-01 19:23:32
阅读次数:
202
Description:Given an input string, reverse the string word by word.For example,Given s = "the sky is blue",return "blue is sky the".Clarification:What...
分类:
其他好文 时间:
2014-08-01 04:38:31
阅读次数:
183
Problem Description:
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 numbe...
分类:
其他好文 时间:
2014-07-31 20:47:17
阅读次数:
215
Just corner case..class Solution {public: ListNode *reverseBetween(ListNode *head, int m, int n) { if(m == n) return head; ListNode *...
分类:
其他好文 时间:
2014-07-31 09:34:05
阅读次数:
245
定义一个队栈,每次出现一个数放进栈中,若出现运算符的话,就将栈顶的两个元素出栈进行运算后在放入栈考虑特殊情况1.只有一个数字的时候2.出现负数的情况class Solution{public: int evalRPN(vector &tokens) { // if(token...
分类:
其他好文 时间:
2014-07-30 07:40:03
阅读次数:
169
考虑几个特殊的情况1.若字符窜s=" "2.字符窜s=“a b d e”3.字符窜s=“ a”然后在s后面+上一个‘ ’,每次遇到s[i]为空格,s[i-1]不为空格的时候为一个单词class Solution{public: void reverseWords(string &s) ...
分类:
其他好文 时间:
2014-07-30 07:38:43
阅读次数:
171
Reverse Integer
java,python,C++三种代码练习
Reverse digits of an integer.
Example1: x = 123, return 321
Example2: x = -123, return -321
click to show s...
分类:
其他好文 时间:
2014-07-29 22:02:52
阅读次数:
333
问题描述:
Given an input string, reverse the string word by word.
For example,
Given s = "the sky is blue",
return "blue is sky the".
解题思路:
每遍历出一个单词时,将该单词添加一个空格字符(如果临时字符串为空,即扫描出第一个单词,就不要添加空格字符),然后添加...
分类:
其他好文 时间:
2014-07-29 21:52:52
阅读次数:
239