![](https://img-blog.csdnimg.cn/20201014180756780.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
LeetCode
alickmchang
这个作者很懒,什么都没留下…
展开
-
[LeetCode] 500. Keyboard Row
public class Solution { public String[] findWords(String[] words) { if(words == null || words.length == 0){ return new String[0]; } Map map = new HashMap<>();原创 2017-03-30 09:38:11 · 256 阅读 · 0 评论 -
[LeetCode] 40. Combination Sum II
public class Solution { public List> combinationSum2(int[] candidates, int target) { List> list = new ArrayList<>(); Arrays.sort(candidates); helper(list, new ArrayList<>()原创 2017-03-30 23:36:45 · 223 阅读 · 0 评论 -
[LeetCode] 216. Combination Sum III
public class Solution { public List> combinationSum3(int k, int n) { List> list = new ArrayList<>(); if(k > n){ return list; } helper(list, new ArrayLis原创 2017-03-30 23:44:15 · 209 阅读 · 0 评论 -
[LeetCode] 104. Maximum Depth of Binary Tree
/** * Definition for a binary tree node. * public class TreeNode { * int val; * TreeNode left; * TreeNode right; * TreeNode(int x) { val = x; } * } */ public class Solution {原创 2017-03-30 23:46:38 · 299 阅读 · 0 评论 -
[LeetCode] 144. Binary Tree Preorder Traversal
/** * Definition for a binary tree node. * public class TreeNode { * int val; * TreeNode left; * TreeNode right; * TreeNode(int x) { val = x; } * } */ public class Solution {原创 2017-03-30 23:47:21 · 324 阅读 · 0 评论 -
[LeetCode] 226. Invert Binary Tree
/** * Definition for a binary tree node. * public class TreeNode { * int val; * TreeNode left; * TreeNode right; * TreeNode(int x) { val = x; } * } */ public class Solution {原创 2017-03-30 23:48:34 · 404 阅读 · 0 评论 -
[LeetCode] 199. Binary Tree Right Side View
/** * Definition for a binary tree node. * public class TreeNode { * int val; * TreeNode left; * TreeNode right; * TreeNode(int x) { val = x; } * } */ public class Solution {原创 2017-03-31 09:51:41 · 350 阅读 · 0 评论 -
[LeetCode] 101. Symmetric Tree
/** * Definition for a binary tree node. * public class TreeNode { * int val; * TreeNode left; * TreeNode right; * TreeNode(int x) { val = x; } * } */ public class Solution {原创 2017-03-31 09:53:20 · 378 阅读 · 0 评论 -
[LeetCode] 98. Validate Binary Search Tree
/** * Definition for a binary tree node. * public class TreeNode { * int val; * TreeNode left; * TreeNode right; * TreeNode(int x) { val = x; } * } */ public class Solution {原创 2017-03-31 09:54:10 · 319 阅读 · 0 评论 -
[LeetCode] 102. Binary Tree Level Order Traversal
/** * Definition for a binary tree node. * public class TreeNode { * int val; * TreeNode left; * TreeNode right; * TreeNode(int x) { val = x; } * } */ public class Solution {原创 2017-03-31 10:02:11 · 316 阅读 · 0 评论 -
[LeetCode] 290. Word Pattern
public class Solution { public boolean wordPattern(String pattern, String str) { Map map1 = new HashMap<>(); Map map2 = new HashMap<>(); String[] strs = str.trim().split("\原创 2017-03-31 10:56:18 · 387 阅读 · 0 评论 -
[LeetCode] 79. Word Search
public class Solution { public boolean exist(char[][] board, String word) { if(board == null || board.length == 0){ return false; } if(word.length() == 0){原创 2017-03-31 11:39:00 · 252 阅读 · 0 评论 -
[LeetCode] 39. Combination Sum
public class Solution { public List> combinationSum(int[] candidates, int target) { List> list = new ArrayList<>(); if(candidates == null || candidates.length == 0){ re原创 2017-03-30 16:46:55 · 175 阅读 · 0 评论 -
[LeetCode] 77. Combinations
public class Solution { public List> combine(int n, int k) { List> list = new ArrayList<>(); if(n < k){ return list; } helper(list, new ArrayList<>(), n原创 2017-03-30 16:39:23 · 192 阅读 · 0 评论 -
[LeetCode] 148. Sort List
/** * Definition for singly-linked list. * public class ListNode { * int val; * ListNode next; * ListNode(int x) { val = x; } * } */ public class Solution { public ListNode sort原创 2017-03-30 11:00:46 · 185 阅读 · 0 评论 -
[LeetCode] 83. Remove Duplicates from Sorted List
/** * Definition for singly-linked list. * public class ListNode { * int val; * ListNode next; * ListNode(int x) { val = x; } * } */ public class Solution { public ListNode dele原创 2017-03-30 11:07:55 · 174 阅读 · 0 评论 -
[LeetCode] 153. Find Minimum in Rotated Sorted Array
public class Solution { public int findMin(int[] nums) { if(nums == null){ return 0; } int lo = 0, hi = nums.length - 1; int target = nums[hi];原创 2017-03-30 14:38:15 · 208 阅读 · 0 评论 -
[LeetCode] 108. Convert Sorted Array to Binary Search Tree
/** * Definition for a binary tree node. * public class TreeNode { * int val; * TreeNode left; * TreeNode right; * TreeNode(int x) { val = x; } * } */ public class Solution {原创 2017-03-30 14:59:25 · 256 阅读 · 0 评论 -
[LeetCode] 21. Merge Two Sorted Lists
/** * Definition for singly-linked list. * public class ListNode { * int val; * ListNode next; * ListNode(int x) { val = x; } * } */ public class Solution { public ListNode merg原创 2017-03-30 15:02:43 · 192 阅读 · 0 评论 -
[LeetCode] 109. Convert Sorted List to Binary Search Tree
/** * Definition for singly-linked list. * public class ListNode { * int val; * ListNode next; * ListNode(int x) { val = x; } * } */ /** * Definition for a binary tree node. * pub原创 2017-03-30 15:12:53 · 225 阅读 · 0 评论 -
[LeetCode] 82. Remove Duplicates from Sorted List II
/** * Definition for singly-linked list. * public class ListNode { * int val; * ListNode next; * ListNode(int x) { val = x; } * } */ public class Solution { public ListNode dele原创 2017-03-30 15:24:29 · 278 阅读 · 0 评论 -
[LeetCode] 46. Permutations
public class Solution { public List> permute(int[] nums) { List> list = new ArrayList<>(); if(nums == null){ return list; } helper(list, new ArrayList<>原创 2017-03-30 15:29:54 · 188 阅读 · 0 评论 -
[LeetCode] 47. Permutations II
public class Solution { public List> permuteUnique(int[] nums) { List> list = new ArrayList<>(); if(nums == null){ return list; } Arrays.sort(nums);原创 2017-03-30 15:46:02 · 211 阅读 · 0 评论 -
[LeetCode] 78. Subsets
public class Solution { public List> subsets(int[] nums) { List> list = new ArrayList<>(); if(nums == null){ return list; } helper(list, new ArrayList<>原创 2017-03-30 16:24:11 · 219 阅读 · 0 评论 -
[LeetCode] 90. Subsets II
public class Solution { public List> subsetsWithDup(int[] nums) { List> list = new ArrayList<>(); if(nums == null){ return list; } Arrays.sort(nums);原创 2017-03-30 16:30:30 · 183 阅读 · 0 评论 -
[LeetCode] 114. Flatten Binary Tree to Linked List
/** * Definition for a binary tree node. * public class TreeNode { * int val; * TreeNode left; * TreeNode right; * TreeNode(int x) { val = x; } * } */ public class Solution {原创 2017-03-31 09:56:41 · 360 阅读 · 0 评论