??
操作Collection以及Map的工具类:Collections
reverse(List):反转 List 中元素的顺序
shuffle(List):对 List 集合元素进行随机排序
sort(List):根据元素的自然顺序对指定 List 集合元素按升序排序
sort(List,Comparator):根据指定的 Comparator 产生的顺序对 List 集合元素进行排...
分类:
其他好文 时间:
2014-09-30 12:30:39
阅读次数:
202
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 as a link...
分类:
其他好文 时间:
2014-09-30 04:40:32
阅读次数:
182
题目描述:Reverse digits of an integer.Example1:x = 123, return 321Example2:x = -123, return -321解题方案:该题比较简单,直接贴代码: 1 class Solution { 2 public: 3 int ...
分类:
其他好文 时间:
2014-09-29 23:48:01
阅读次数:
164
实现将一个句子中的单词全部翻转。例:“I am a boy”转“bvoid reverse(char *start, char *end){if(start==NULL || end==NULL)return; while(start<end){ char temp=*start...
分类:
其他好文 时间:
2014-09-29 12:50:30
阅读次数:
112
代码如下: template void reverse(It begin, It end)
{ while(begin != end) { --end; if(begin != end) std::swap(*begin++, *end); }
} 注意几点: 1.不能一开始...
分类:
其他好文 时间:
2014-09-28 21:37:45
阅读次数:
232
字符串循环移位:假设有一串字符串a,b,c,d,e,f,g,h,向左循环移位2为,得c,d,e,f,g,h,a,b。
#include
using namespace std;
void reverse(char* a, int start, int len){
int count = 0;
for(int i = start, j = start + len -1; ; ++i, --...
分类:
其他好文 时间:
2014-09-28 12:28:20
阅读次数:
140
题目描述:Evaluate the value of an arithmetic expression inReverse Polish Notation.Valid operators are+,-,*,/. Each operand may be an integer or another ex...
分类:
其他好文 时间:
2014-09-28 11:27:51
阅读次数:
164
#include#include#include#include#include#include#includeusingnamespacestd;intevalRPN(vector&tokens){stackvalue;inti=0;for(i=0;is;s.push_back("4");s.pu...
分类:
其他好文 时间:
2014-09-28 00:52:20
阅读次数:
209
#include#include#include#includeusingnamespacestd;voidreverseWords(string&s){stringrs;for(inti=s.length()-1;i>=0;){while(s[i]==''&&i>=0)i--;if(i=0)t.p...
分类:
其他好文 时间:
2014-09-28 00:14:40
阅读次数:
220
如果是单纯的加减运算表达式,非常简单,依次处理表达式的头字符就可以了。但是对于四则运算来说,有括号,又有先乘除,后加减使得表达式处理变得负责。20世纪50年代,波兰逻辑学家Jan Lukasiewicz发明了不需要括号的后缀表达式,精妙地解决的这个问题。比如说char sInput[]="9+(3-...
分类:
其他好文 时间:
2014-09-27 12:23:59
阅读次数:
200