该题答案如下:class Solution {public: string addBinary(string a, string b) { string::reverse_iterator itea,iteb; string result; char temp; ...
分类:
其他好文 时间:
2014-12-21 11:30:10
阅读次数:
254
Given 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 multiple ofkthen left-o...
分类:
其他好文 时间:
2014-12-20 01:59:41
阅读次数:
190
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...
分类:
其他好文 时间:
2014-12-19 17:19:23
阅读次数:
231
题目:
可以点击“click to show spoilers”,查看需要考虑的问题。我是做题的时候没有查看,结果里面给出的三个注意的地方只考虑了两个,导致提交之后溢出,之后又重新考虑。
我的解决方案:
public class Solution {
public int reverse(int x) {
char[] sArray = String.va...
分类:
其他好文 时间:
2014-12-19 12:11:49
阅读次数:
181
/*
*Author : DavidLin
*Date : 2014-12-15pm
*Email : linpeng1577@163.com or linpeng1577@gmail.com
*world : the city of SZ, in China
*Ver : 000.000.001 *For : reve...
分类:
其他好文 时间:
2014-12-18 22:19:38
阅读次数:
182
首先先贴一下题目: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...
分类:
其他好文 时间:
2014-12-18 13:31:49
阅读次数:
194
题目Reverse Integer通过率34.2%难度EasyReverse digits of an integer.Example1:x = 123, return 321Example2:x = -123, return -321click to show spoilers.Have you ...
分类:
其他好文 时间:
2014-12-18 13:30:17
阅读次数:
134
将句子的词反转,例如:Given s = "the sky is blue",return "blue is sky the".思路:就是从后面往前,找到非空格的长度,然后取到另一个串中。遍历一次就可以了。如下:class Solution {public: void reverseWords...
分类:
其他好文 时间:
2014-12-18 10:11:34
阅读次数:
148
逆波兰表示法,在维基百科here一不小心就看到了维基上有说用栈处理。然后就用栈处理了。需要注意的是,操作数前后不要弄错,stoi可以调用。它应该是在stdlib.h的头文件里,不过我在codeblock上试了不行。class Solution {public: int evalRPN(vect...
分类:
其他好文 时间:
2014-12-17 23:59:37
阅读次数:
393
【题目】
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 then left-out nodes in the end should remai...
分类:
其他好文 时间:
2014-12-17 18:37:28
阅读次数:
188