题目:
可以点击“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
Command class: aliases
ni -- Step one instruction
rc -- Continue program being debugged but run it in reverse
rni -- Step backward one instruction
rsi -- Step backward exactly one instruction
...
分类:
数据库 时间:
2014-12-17 12:57:13
阅读次数:
302
1.push() //可以接受任意参数,然后添加到数组的末尾2.pop()//栈方法,在数组末尾删除一条数据,并且返回这条数据3.shift()//队列方法,与pop()相似,但是与其相反,在数组的开始位置删除一条数据,并返回这条数据。4.reverse(),sort() //数组排序方法,sort...
分类:
编程语言 时间:
2014-12-17 12:36:24
阅读次数:
329
之前做过链表的翻转,这里看到一个更简单的实现
ListNode* Reverse(ListNode *head) {
ListNode *reHead = NULL;
ListNode *prev = NULL;
ListNode *Node = head;
while(Node != NULL) {
ListNode *next = Node->...
分类:
其他好文 时间:
2014-12-17 01:40:23
阅读次数:
248