KMP算法讲解
我的Java代码实现
package jj4_6;
public class KMP {
public static boolean contains(String a,String b){
/*
* 第一步,对b字符串做一个预处理
*/
Integer[] fuzhu = new Integer[b.length()];
for...
分类:
编程语言 时间:
2015-04-06 18:47:19
阅读次数:
134
在软件测试的课上,老师介绍了闰年测试。闰年测试旨在检测某一年份是否为闰年,计算方式为四年一闰,百年不闰,四百年再闰。使用安卓实现这个小程序。 界面代码如下: 1 7 8 13 14 23 24 25 32 33 结果如下: 在我的程序中,使用Integer.pars...
分类:
移动开发 时间:
2015-04-06 18:40:32
阅读次数:
203
Java 中 String转int有两种常用方法: 第一种方法:i=Integer.parseInt(str); 第二种方法:i=Integer.valueOf(str).intValue();以上两种方法都可以实现string转int,但两者有一点区别,第一种方法直接使用的String...
分类:
其他好文 时间:
2015-04-06 18:38:16
阅读次数:
131
通过对LRC文件的解析,可以轻松实现歌词可视化.函数名:paintLyrics(ByVal pBox As PictureBox, ByVal CurrentPosition As Integer, ByVal type As Boolean, Optional ByVal pLyric As .....
分类:
其他好文 时间:
2015-04-06 18:26:19
阅读次数:
127
这种题的考察重点并不在于问题本身,而是要注意corner case的处理,整数一般有两点,一个是正负符号问题,另一个是整数越界问题。思路比较简单,就是先去掉多余的空格字符,然后读符号(注意正负号都有可能,也有可能没有符号),接下来按顺序读数字,结束条件有三种情况:(1)异常字符出现(按照C语言的标准是把异常字符起的后面全部截去,保留前面的部分作为结果);(2)数字越界(返回最接近的整数);(3)字...
分类:
其他好文 时间:
2015-04-06 17:22:19
阅读次数:
137
Given an unsorted integer array, find the first missing positive integer.For example,Given[1,2,0]return3,and[3,4,-1,1]return2.Your algorithm should ru...
分类:
其他好文 时间:
2015-04-06 15:29:32
阅读次数:
108
1 class Solution { 2 public: 3 /** 4 * @param m: An integer m denotes the size of a backpack 5 * @param A: Given n items with size A[i]...
分类:
其他好文 时间:
2015-04-06 14:10:13
阅读次数:
109
1 class Solution { 2 public: 3 /** 4 * @param m: An integer m denotes the size of a backpack 5 * @param A & V: Given n items with size ...
分类:
其他好文 时间:
2015-04-06 14:08:59
阅读次数:
135
Given an integer array, find a subarray where the sum of numbers is zero. Your code should return the index of the first number and the index of the l...
分类:
其他好文 时间:
2015-04-06 14:05:45
阅读次数:
116
int nMax = Integer.parseInt(arr[0]);//最大值
int nMin = Integer.parseInt(arr[0]);//最小值
for (int i = 0; i Integer.parseInt(arr[i])) {...
分类:
编程语言 时间:
2015-04-06 12:54:06
阅读次数:
171