- 博客(7)
- 收藏
- 关注
转载 KMP alg.
public class KMP { private int[][] dp; private String pat; public KMP(String pat) { this.pat = pat; int M = pat.length(); // dp[状态][字符] = 下个状态 dp = new in...
2019-12-26 16:13:13
51
转载 Scanner
读取多行输入Scanner sc = new Scanner(System.in);Arraylist<Integer> list = new Arraylist<>();while(sc.hasNext()){ String str = sc.nextline(); list.add(Integer.valueof(str));}System.out.pri...
2019-11-20 13:19:55
64
原创 int to string
class A{ public static void main(String args[]) { //Integer.toString int a = 1234; int b = -1234; String str1 = Integer.toString(a); String str2 = Integer.toString(b); S...
2019-11-20 05:17:57
134
转载 list to array, both way
//要转换的list集合 List<String> testList = new ArrayList<String>(){{add("aa");add("bb");add("cc");}}; //使用toArray(T[] a)方法 String[] array2 = testList.toArray(new String[testList.size()]);/...
2019-11-19 15:00:34
64
原创 16.3sum closest
16.3sum closestimport java.lang.Math;import java.util.*;class Solution { public int threeSumClosest(int[] nums, int target) { int clos_sum = nums[0]+nums[1]+nums[2]; int ini_diff= Math....
2019-11-18 06:17:44
73
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人