//如果有pow函数,Linux下编译一定要加-lm
//gcc ReverseInteger.c -o ReverseInteger -lm
关键:一定要注意操作过程中int类型超界
有可能输入数据没有超界,但是反向逆序后,甚至在逆序操作过程中都有可能超界!反正时刻检查超界与否#include
#include
#include...
分类:
其他好文 时间:
2015-06-28 21:41:32
阅读次数:
149
题目:Given an array of size n, find the majority element. The majority element is the element that appears more than ? n/2 ? times.
找出数组中出现超过? n/2 ?次的数据
三种解法:
1、参考别人的,很巧的解法
2、插入排序,排序后,nums? n/2 ?必定是出...
分类:
其他好文 时间:
2015-06-28 21:40:06
阅读次数:
145
开发过程中接触到了从jdk1.5---jdk1.7的使用,在不同的阶段,都使用过了jdk的一些新特性,操作起来更加方面啦!特此总结了下,与喜欢it 的朋友共勉!呵呵以下是测试代码:JDK1.5新特性:1.自动装箱与拆箱:Integer iObj = 3;System.out.println(iObj...
分类:
其他好文 时间:
2015-06-28 21:33:12
阅读次数:
143
使用 sstream 完成转换, 1 #include 2 #include 3 #include 4 #include 5 6 int main () 7 { 8 std::string str_integer; 9 uint64_t integer;10 11 std:...
分类:
编程语言 时间:
2015-06-28 20:07:34
阅读次数:
181
1 class Solution { 2 public: 3 /** 4 * @param grid: a list of lists of integers. 5 * @return: An integer, minimizes the sum of all numb...
分类:
其他好文 时间:
2015-06-28 17:30:04
阅读次数:
369
需要将groovy-2.4.3.jar加入到classpath中一:在java中用GroovyClassLoader执行groovy代码CalculateMax.groovy1 class CalculateMax{2 def Integer getMax(List values){3 ...
分类:
编程语言 时间:
2015-06-28 15:30:59
阅读次数:
118
importjava.util.ArrayList;importjava.util.Scanner;publicclassBaseType{//字符串强制转换为整形publicintstringtoint(Strings){inta=Integer.parseInt(s);returna;}//字符...
分类:
编程语言 时间:
2015-06-27 21:20:03
阅读次数:
116
Given a sorted integer array without duplicates, return the summary of its ranges.For example, given[0,1,2,4,5,7], return["0->2","4->5","7"]. 1 class ...
分类:
其他好文 时间:
2015-06-27 19:37:25
阅读次数:
110
function TControl.GetText: TCaption;var Len: Integer;begin Len := GetTextLen; SetString(Result, PChar(nil), Len); if Len 0 then GetTextBuf(Pointe...
分类:
其他好文 时间:
2015-06-27 17:58:16
阅读次数:
128
//TStringList 常用方法与属性:var List: TStringList; i: Integer;begin List := TStringList.Create; List.Add('Strings1'); {添加} List.Add('Strings2'); List.E...
分类:
其他好文 时间:
2015-06-27 15:48:18
阅读次数:
96