随机输入一个数,判断它是不是对称数(回文数)(如3,121,12321,45254)。不能用字符串库函数 1 bool Symmetry(int input) 2 { 3 int number = input; 4 int reverse = 0; 5 while (numb...
分类:
其他好文 时间:
2014-09-01 10:33:52
阅读次数:
230
问题描述
Given an input string, reverse the string word by word.
For example,
Given s = "the sky is blue",
return "blue is sky the".
解决方案public class Solution {
public String reverseWord...
分类:
其他好文 时间:
2014-08-31 23:04:42
阅读次数:
232
LeetCode: Reverse Linked ListReverse 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 ...
分类:
其他好文 时间:
2014-08-31 22:45:51
阅读次数:
215
Question: Reverse Words in a StringGiven an input string, reverse the string word by word.For example,Given s = "the sky is blue",return "blue is sky ...
分类:
其他好文 时间:
2014-08-31 17:03:21
阅读次数:
232
#include #include using namespace std;void reverse(char* str) { int length = strlen(str); char* str_head = str; char* str_tail = &str[length-1]; w...
分类:
其他好文 时间:
2014-08-31 06:03:10
阅读次数:
253
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 remain as it is...
分类:
其他好文 时间:
2014-08-30 11:14:19
阅读次数:
209
【题意】
逆波兰表达式,又叫后缀表达式。
例如:
["2", "1", "+", "3", "*"] -> ((2 + 1) * 3) -> 9
["4", "13", "5", "/", "+"] -> (4 + (13 / 5)) -> 6
【思路】
用一个栈存储操作数,遇到操作数直接压入栈内,遇到操作符就把栈顶的两个操作数拿出来运算一下,然后把运算结果放入栈内。
【Jav...
分类:
其他好文 时间:
2014-08-28 21:13:36
阅读次数:
247
【题意】
给定一个字符串,把里面的单词逆序输出来。
例如:给定 s = "the sky is blue",返回 "blue is sky the"。
注意:接收的字符串开头和结尾可能有空格,但是返回时开头和结尾不能有空格;返回时每两个单词之间只能有一个空格。
【Java代码】
public class Solution {
public String reverseWords(...
分类:
其他好文 时间:
2014-08-28 18:10:15
阅读次数:
199
Guava的Ordering可以说是更加强大的Javacomparator,Ordering本身就是一个继承于Comparator的接口,但是它还支持一些基于Comparator的操作例如reverse,max,min,它甚至还可以通过不同Ordering之间的组合或者链接(用Decorate的模式)完成更加强大的排序功能。创建有四种比较常见..
分类:
其他好文 时间:
2014-08-28 09:50:19
阅读次数:
154
XXD(1) General Commands Manual XXD(1)NAME xxd - make a hexdump or do the reverse.SYNOPSIS xxd -h[elp] xxd [options] [infile [outfile]] xxd -r[evert] [...
分类:
系统相关 时间:
2014-08-27 23:16:18
阅读次数:
665