Implementatoito convert a string to an integer.Hint:Carefully consider all possible input cases. If you want a challenge, please do not see below and ...
分类:
其他好文 时间:
2015-04-25 22:40:26
阅读次数:
147
通过其他方式实现string函数的效果,效果有比较数组字符、显示字符串长度、复制字符串等。在比较字符串的时候,首先是比较字符串的长度,当长度一样的时候进行不同位置上一一对应的字符比较大小。关于字符长度是使用返回值return count;来循环相加实现的,count代表数组的上不同位置的下标,if(...
分类:
其他好文 时间:
2015-04-25 22:38:33
阅读次数:
161
Reverse digits of an integer. Example1: x = 123, return 321Example2: x = -123, return -321解题思路:将数字翻转并不难,可以转成String类型翻转,也可以逐位翻转,本题涉及到的主要是边界和溢出问题,使用Long...
分类:
编程语言 时间:
2015-04-25 22:38:15
阅读次数:
167
一、泛型:简单说就是对对象类型进行限定的技术public class GenericDemo { public static void main(String[] args){ /*泛型作为1.5版之后的新技术,分两步使用 * 1、在类名之后用,这里就像函数中的普...
分类:
编程语言 时间:
2015-04-25 22:34:50
阅读次数:
281
慢慢的,回想起以前学习JAVA和C#当中的的类的特性了。感觉大同小异吧。。。package com.hengheng.scalaclass OOPInScala {}class Student(name: String, age : Int, val major : String) extends ...
分类:
其他好文 时间:
2015-04-25 22:31:39
阅读次数:
200
今天学的一些小方法:错误:url通过get传递时汉字出错解决:url通过get传递时汉字会乱码, 1.String name1=request.getParameter("name"); String name = new String(name1.getBytes("ISO-8859...
分类:
数据库 时间:
2015-04-25 22:23:41
阅读次数:
244
作了解,感觉比一般的差距有点大哟。package com.hengheng.scalaclass HelloScala {}object HelloScala { def main(args: Array[String]) { val max = 1 val result = if...
分类:
其他好文 时间:
2015-04-25 22:22:08
阅读次数:
145
package?com.yuan.test;
public?class?Testyuhuo?{
????public?static?void?main(String[]?args){
????????int?i=3;
????????System.out.println("i++:"+i++);?//output:3
?...
分类:
编程语言 时间:
2015-04-25 21:19:24
阅读次数:
181
问题:翻转字符串中的单词顺序,如“hello world”变成“world hello”。要求使用常量空间。
c++代码如下:
void reverse(string &s, int start, int end){
int len=end+start;
int center=len/2;
for(int i=start;i<center;i++){
...
分类:
其他好文 时间:
2015-04-25 21:13:09
阅读次数:
127
Write a function to find the longest common prefix string amongst an array of strings.这题是寻找一组字符串的最长公共前缀,举个例子:“abc” "a"显然lPrefixString = "a",注意检查空串的情况!...
分类:
其他好文 时间:
2015-04-25 19:48:20
阅读次数:
114