This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class Solution { | |
| public ArrayList<ArrayList<Integer>> combinationSum(int[] candidates, int target) { | |
| ArrayList<ArrayList<Integer>> ret = new ArrayList<ArrayList<Integer>>(); | |
| Arrays.sort(candidates); | |
| ArrayList<Integer> al = new ArrayList<Integer>(); | |
| helper(candidates,target,al,ret,0); | |
| return ret; | |
| } | |
| public void helper(int[] can, int t, ArrayList<Integer> al, ArrayList<ArrayList<Integer>> ret, int i ){ | |
| if (t == 0){ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class Solution { | |
| public boolean isValidSudoku(char[][] board) { | |
| // Start typing your Java solution below | |
| // DO NOT write main() function | |
| for(int i = 0; i < board.length; i++){ | |
| HashSet hm = new HashSet(); | |
| for(int j = 0; j < board.length; j++){ | |
| if (hm.contains(board[i][j]) && (board[i][j] != '.')) | |
| return false; | |
| hm.add(board[i][j]); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class Solution { | |
| public int searchInsert(int[] A, int target) { | |
| // Start typing your Java solution below | |
| // DO NOT write main() function | |
| return helper(A,target,0,A.length-1); | |
| } | |
| public int helper(int[]a , int t, int s, int e){ | |
| if (e < s) | |
| return s; | |
| int m = (s+e)/2; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class Solution { | |
| public int[] searchRange(int[] A, int target) { | |
| int[] ret = new int[2]; | |
| ret[0] = helper(A,target-0.1,0,A.length-1); | |
| ret[1] = helper(A,target+0.1,0,A.length-1); | |
| return ret; | |
| } | |
| public int helper(int[] a, double t,int s, int e){ | |
| if (e < s){ | |
| if (s >= a.length) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class Solution { | |
| public int search(int[] A, int target) { | |
| // Start typing your Java solution below | |
| // DO NOT write main() function | |
| int s = 0; | |
| int e = A.length -1; | |
| return sear(A,target,s,e); | |
| } | |
| public int sear(int[] A, int tar, int s, int e){ | |
| if (e < s) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import java.io.BufferedReader; | |
| import java.io.BufferedWriter; | |
| import java.io.FileReader; | |
| import java.io.FileWriter; | |
| import java.util.ArrayList; | |
| import java.util.HashMap; | |
| import java.util.Iterator; | |
| import java.util.Set; | |
| public class Solution { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import java.io.BufferedReader; | |
| import java.io.BufferedWriter; | |
| import java.io.FileReader; | |
| import java.io.FileWriter; | |
| import java.util.ArrayList; | |
| import java.util.HashMap; | |
| import java.util.Iterator; | |
| import java.util.Set; | |
| public class Solution { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import java.io.BufferedReader; | |
| import java.io.BufferedWriter; | |
| import java.io.FileReader; | |
| import java.io.FileWriter; | |
| import java.util.ArrayList; | |
| import java.util.HashMap; | |
| import java.util.Iterator; | |
| import java.util.Set; | |
| public class Solution { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 1. cmu machine learning online class | |
| http://alex.smola.org/teaching/cmu2013-10-701/index.html |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import java.io.BufferedReader; | |
| import java.io.BufferedWriter; | |
| import java.io.FileReader; | |
| import java.io.FileWriter; | |
| import java.util.ArrayList; | |
| import java.util.HashMap; | |
| import java.util.Iterator; | |
| import java.util.Set; | |
| public class Solution { |
NewerOlder