- 博客(27)
- 问答 (1)
- 收藏
- 关注
原创 [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
原创 [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
原创 [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
原创 [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
原创 [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
原创 [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
原创 [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
原创 [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
原创 [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
原创 [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
原创 [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
原创 [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
原创 [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
原创 [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
原创 [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
原创 [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
原创 [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
原创 [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
原创 [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
原创 [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
原创 [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
原创 [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
原创 [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
原创 [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
原创 [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
原创 排序算法
1.冒泡排序 public static void bubbleSort(int[] nums){ for(int i = 0; i < nums.length - 1; i++){ boolean flag = true; for(int j = 0; j < nums.length - 1 - i; j++){
2017-03-30 09:42:11
254
原创 [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
空空如也
如何在切换Fragment时不销毁SurfaceView
2016-03-27
TA创建的收藏夹 TA关注的收藏夹
TA关注的人