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 { | |
| /** | |
| * @param A : An integer array | |
| * @return : An integer | |
| */ | |
| public int singleNumberII(int[] A) { | |
| // write your code here | |
| if (A == null || A.length == 0) { | |
| return -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
| public class Solution { | |
| /** | |
| * @param A: an integer array. | |
| * @param k: a positive integer (k <= length(A)) | |
| * @param target: a integer | |
| * @return a list of lists of integer | |
| */ | |
| public ArrayList<ArrayList<Integer>> kSumII(int A[], int k, int target) { | |
| // write your code here | |
| if (A == null || A.length == 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
| /** | |
| * Definition for Directed graph. | |
| * class DirectedGraphNode { | |
| * int label; | |
| * ArrayList<DirectedGraphNode> neighbors; | |
| * DirectedGraphNode(int x) { label = x; neighbors = new ArrayList<DirectedGraphNode>(); } | |
| * }; | |
| */ | |
| 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
| /** | |
| * Definition for Directed graph. | |
| * class DirectedGraphNode { | |
| * int label; | |
| * ArrayList<DirectedGraphNode> neighbors; | |
| * DirectedGraphNode(int x) { label = x; neighbors = new ArrayList<DirectedGraphNode>(); } | |
| * }; | |
| */ | |
| 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
| public class Solution { | |
| /** | |
| * @param candidates: A list of integers | |
| * @param target:An integer | |
| * @return: A list of lists of integers | |
| */ | |
| public List<List<Integer>> combinationSum(int[] candidates, int target) { | |
| // write your code here | |
| List<List<Integer>> result = new ArrayList<>(); | |
| if (candidates == null || candidates.length == 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
| /** | |
| * Definition for undirected graph. | |
| * class UndirectedGraphNode { | |
| * int label; | |
| * ArrayList<UndirectedGraphNode> neighbors; | |
| * UndirectedGraphNode(int x) { label = x; neighbors = new ArrayList<UndirectedGraphNode>(); } | |
| * }; | |
| */ | |
| 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
| public class Solution { | |
| /** | |
| * @param s: A string | |
| * @return: A list of lists of string | |
| */ | |
| public List<List<String>> partition(String s) { | |
| // write your code here | |
| List<List<String>> result = new ArrayList<>(); | |
| if (s == null || s.isEmpty()) { | |
| return result; |
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 ListNode. | |
| * public class ListNode { | |
| * int val; | |
| * ListNode next; | |
| * ListNode(int val) { | |
| * this.val = val; | |
| * this.next = null; | |
| * } | |
| * } |
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 singly-linked list. | |
| * public class ListNode { | |
| * int val; | |
| * ListNode next; | |
| * ListNode(int x) { | |
| * val = x; | |
| * next = null; | |
| * } | |
| * } |
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 ListNode | |
| * public class ListNode { | |
| * int val; | |
| * ListNode next; | |
| * ListNode(int x) { | |
| * val = x; | |
| * next = null; | |
| * } | |
| * } |