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 String multiply(String num1, String num2) { | |
| // Start typing your Java solution below | |
| // DO NOT write main() function | |
| int adv = 0; | |
| int[] num = new int[num1.length() + num2.length() ]; | |
| num1 = new StringBuffer(num1).reverse().toString(); | |
| num2 = new StringBuffer(num2).reverse().toString(); | |
| for (int i = 0; i < num1.length(); i++) { | |
| for (int j = 0; j < num2.length(); 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 String minWindow(String S, String T) { | |
| // Start typing your Java solution below | |
| // DO NOT write main() function | |
| int[] num = new int[256]; | |
| int[] hasFound = new int[256]; | |
| for (int i = 0; i < T.length(); i++) { | |
| num[T.charAt(i)]++; | |
| } | |
| int found = 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 String minWindow(String S, String T) { | |
| // Start typing your Java solution below | |
| // DO NOT write main() function | |
| HashMap<Character, LinkedList<Integer>> hash = new HashMap<Character, LinkedList<Integer>>(); | |
| HashSet<Character> set = new HashSet<Character>(); | |
| PriorityQueue<Integer> pq = new PriorityQueue<Integer>(); | |
| int[] num = new int[256]; | |
| for (int i = 0; i < T.length(); i++) { | |
| num[T.charAt(i)]++; |
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 isInterleave(String s1, String s2, String s3) { | |
| // Start typing your Java solution below | |
| // DO NOT write main() function | |
| if (s1.length() + s2.length() != s3.length()) | |
| return false; | |
| boolean[][] sol = new boolean[s1.length() + 1][s2.length() + 1]; | |
| sol[0][0] = true; |
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 isMatch(String s, String p) { | |
| // Start typing your Java solution below | |
| // DO NOT write main() function | |
| boolean[][] sol = new boolean[s.length() + 1][p.length() + 1]; | |
| sol[0][0] = true; | |
| for (int i = 2; i <= p.length(); i++) { | |
| if (p.charAt(i - 1) == '*') { | |
| sol[0][i] = sol[0][i - 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 boolean isMatch(String s, String p) { | |
| // Start typing your Java solution below | |
| // DO NOT write main() function | |
| boolean[][] sol = new boolean[2][p.length() + 1]; | |
| sol[0][0] = true; | |
| int len = 0; | |
| for (int i = 1; i <= p.length(); i++) { | |
| if (p.charAt(i - 1) == '*') | |
| sol[0][i] = sol[0][i - 1]; |
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
| /** | |
| * Definition for an interval. | |
| * public class Interval { | |
| * int start; | |
| * int end; | |
| * Interval() { start = 0; end = 0; } | |
| * Interval(int s, int e) { start = s; end = e; } | |
| * } | |
| */ | |
| 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
| /** | |
| *The IncidentsCalculation calculates the incidents percentage for a given query and all the incidents. | |
| * | |
| * @author Xidong Liu <xliu035@gmail.com> | |
| */ | |
| import java.util.*; | |
| public class IncidentsCalculation { | |
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
| /** | |
| * The IncidentsCalculationExtension calculates the incidents percentage for a given list of queries and all the incidents. | |
| * | |
| * @author Xidong Liu <xliu035@gmail.com> | |
| */ | |
| import java.util.*; | |
| public class IncidentsCalculationExtension { |
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
| /** | |
| * Definition for binary tree | |
| * public class TreeNode { | |
| * int val; | |
| * TreeNode left; | |
| * TreeNode right; | |
| * TreeNode(int x) { val = x; } | |
| * } | |
| */ | |
| public class Solution { |
NewerOlder