发布时间:2015-03-22 17:08:30
import java.util.ArrayList;import java.util.HashSet;import java.util.Set;//Given a string s and a dictionary of words dict, determine if s can be segmented into a space-separated sequence of one or more dictionary words.////For example, given//s = "leetcode",//.........【阅读全文】
发布时间:2015-03-22 17:07:31
import java.util.ArrayList;import java.util.Arrays;import java.util.List;public class threeSum {public static void main(String[] arg){int[] a=new int[]{0,0,0};System.out.print(threeSumSolution(a));}public static List<List<Integer>> threeSumSolution(int[] num) {List<List<Integer>> temp.........【阅读全文】
发布时间:2015-03-22 17:06:36
//Given an array of integers, every element appears twice except for one. Find that single one.////Note://Your algorithm should have a linear runtime complexity. Could you implement it without using extra memory?public class SingleNumber {public int singleNumber(int[] A) { .........【阅读全文】
发布时间:2015-03-22 17:06:06
public class SetMatrixZeroes {public static void main(String[] args) {// TODO 自动生成的方法存根}public void setZeroes(int[][] matrix) { if(matrix.length==0){ return;  .........【阅读全文】
发布时间:2015-03-22 17:05:19
//Given a roman numeral, convert it to an integer.////Input is guaranteed to be within the range from 1 to 3999.//最后一个用来赋初值,前面的如果大于或等于就加上去,小于就减去这个import java.util.HashMap;import java.util.Map;public class RomanInteger { public int romanToInt(String s) {&nb.........【阅读全文】