- 博客(27)
- 收藏
- 关注
原创 LeetCode 229 --- Majority Element II
题目链接: LeetCode 229 — Majority Element IIAC代码:public class Problem229 { public static void main(String[] args) { // TODO Auto-generated method stub int[] name ={1,1,1,2,3}; m
2017-02-21 19:03:49 326
原创 LeetCode 90 --- Subsets II
题目链接: LeetCode 90 — Subsets IIAC代码:public class Problem90 { public static void main(String[] args) { // TODO Auto-generated method stub } public List<List<Integer>> subsetsWithDup(in
2017-02-21 17:13:15 366
转载 LeetCode 88 --- Merge Sorted Array
问题链接:LeetCode 88 — Merge Sorted ArrayAC代码:public class Problem88 { public static void main(String[] args) { // TODO Auto-generated method stub } //参考 https://discuss.leetcode.com/topi
2017-02-21 17:11:39 285
原创 LeetCode 80 --- Remove Duplicates from Sorted Array II
题目链接: LeetCode 80 — Remove Duplicates from Sorted Array IIAC代码:public class Problem80 { public static void main(String[] args) { // TODO Auto-generated method stub } public int remov
2017-02-21 17:09:38 262
原创 LeetCode 78 --- Subsets
题目链接: LeetCode 78 — SubsetsAC代码:public class Problem78 { public static void main(String[] args) { // TODO Auto-generated method stub } public List<List<Integer>> subsets(int[] nums)
2017-02-21 17:07:43 240
原创 LeetCode 75 --- Sort Colors
题目链接: LeetCode 75 — Sort ColorsAC代码:public class Problem75 { public static void main(String[] args) { // TODO Auto-generated method stub } public class Solution { public void
2017-02-21 17:06:37 298
原创 LeetCode 74 --- Search a 2D Matrix
题目链接:LeetCode 74 — Search a 2D MatrixAC代码:public class Problem74 { public static void main(String[] args) { } // TODO Auto-generated method stub public boolean searchMatrix(int[][] ma
2017-02-21 17:04:51 392
原创 LeetCode 73 --- Set Matrix Zeroes
题目链接: LeetCode 73 — Set Matrix ZeroesAC代码:public class Problem73 { public static void main(String[] args) { // TODO Auto-generated method stub } public void setZeroes(int[][] matrix
2017-02-21 17:03:06 247
原创 LeetCode 66 --- Plus One
题目链接: AC代码:public class Problem66 { public static void main(String[] args) { // TODO Auto-generated method stub } public int[] plusOne(int[] digits) { for(int i=digits.length-1
2017-02-21 17:01:27 211
原创 LeetCode 64 --- Minimum Path Sum
题目链接: LeetCode 64 — Minimum Path SumAC代码:public class Problem64 { public static void main(String[] args) { // TODO Auto-generated method stub } public int minPathSum(int[][] grid) {
2017-02-19 20:59:32 220
原创 LeetCode 63 --- Unique Paths II
题目链接: LeetCode 63 — Unique Paths IIAC代码:public class Problem63 { public static void main(String[] args) { // TODO Auto-generated method stub } public int uniquePathsWithObstacles(int
2017-02-19 20:47:20 201
原创 LeetCode 62 --- Unique Paths
题目链接: LeetCode 62 — Unique Paths问题分析: 简单dp。AC代码:public class Problem62 { public static void main(String[] args) { // TODO Auto-generated method stub System.out.println(uniquePaths(5
2017-02-19 20:22:56 233
转载 LeetCode 59 --- Spiral Matrix II
题目链接: LeetCode 59 — Spiral Matrix IIAC代码:public class Problem59 { public static void main(String[] args) { // TODO Auto-generated method stub } //参考https://discuss.leetcode.com/topic
2017-02-19 20:20:23 211
原创 LeetCode 57 --- Insert Interval
题目链接: LeetCode 57 — Insert IntervalAC代码:public class Problem57 { public static void main(String[] args) { List <Interval> list =new ArrayList<Interval>(); list.add(new Interval(0,2
2017-02-19 20:18:42 247
原创 LeetCode 56 --- Merge Intervals
题目链接: LeetCode 56 — Merge IntervalsAC代码:class Interval { int start; int end; Interval() { start = 0; end = 0; } Interval(int s, int e) { start = s; end = e; } @Override p
2017-02-19 20:17:07 264
原创 LeetCode 55 --- Jump Game
题目链接: LeetCode 55 — Jump GameAC代码:public class Problem55 { public static void main(String[] args) { // TODO Auto-generated method stub } public boolean canJump(int[] nums) {
2017-02-19 20:15:42 192
转载 LeetCode 54 --- Spiral Matrix
题目链接: LeetCode 54 — Spiral MatrixAC代码://参考 https://discuss.leetcode.com/topic/64099/easy-java-solution-with-explainationpublic class Problem54 { public static void main(String[] args) { /
2017-02-19 20:14:17 232
转载 LeetCode 53 --- Maximum Subarray
题目链接: LeetCode 53 — Maximum SubarrayAC代码:public class Problem53 { public static void main(String[] args) { // TODO Auto-generated method stub } public int maxSubArray(int[] nums) {
2017-02-19 20:12:42 178
原创 LeetCode 495 --- Teemo Attacking
题目链接: LeetCode 495 — Teemo AttackingAC代码:public class Problem495 { public static void main(String[] args) { // TODO Auto-generated method stub int[] name={1,2}; System.out.p
2017-02-19 20:10:45 725
原创 LeetCode 485 --- Max Consecutive Ones
题目链接: LeetCode 485 — Max Consecutive OnesAC代码:public class Problem485 { public static void main(String[] args) { // TODO Auto-generated method stub int[] name={1,1,0,1,1,1};
2017-02-19 20:09:18 380
原创 LeetCode 48 --- Rotate Image
题目链接: LeetCode 48 — Rotate ImageAC代码:public class Problem48 { public static void main(String[] args) { // TODO Auto-generated method stub int [][] ss={{1,2},{3,4}}; rotate(s
2017-02-19 20:07:11 231
原创 LeetCode 45 --- Jump Game II
题目链接: LeetCode 45 — Jump Game IIAC代码:public class Problem45 { public static void main(String[] args) { // TODO Auto-generated method stub } public int jump(int[] nums) { if(n
2017-02-19 20:05:41 230
原创 LeetCode 448 --- Find All Numbers Disappeared in an Array
题目链接: LeetCode 448 — Find All Numbers Disappeared in an ArrayAC代码:public class Problem448 { public static void main(String[] args) { int [] a={4,3,2,7,8,2,3,1}; // TODO Auto-generat
2017-02-19 20:03:31 202
原创 LeetCode 442 --- Find All Duplicates in an Array
题目链接: LeetCode 442 — Find All Duplicates in an Array问题分析: 需要o(n)的时间复杂度并且不能使用额外的存储空间。找出数组中的重复元素。AC代码:public class Problem442 { public static void main(String[] args) { // TODO Auto-generat
2017-02-19 19:53:49 713
原创 LeetCode 42 --- Trapping Rain Water
题目链接: LeetCode 42 — Trapping Rain Water问题分析: 贪心思路,很简单。AC代码:public class Problem42 { public static void main(String[] args) { // TODO Auto-generated method stub\ int[] a={};
2017-02-19 19:47:33 187
原创 LeetCode 414 --- Third Maximum Number
题目链接: LeetCode 414 — Third Maximum NumberAC代码:public class Problem414 { public static void main(String[] args) { // TODO Auto-generated method stub int[] aa={2,2,3,1}; thir
2017-02-19 19:41:41 215
原创 LeetCode 169 --- Majority Element
题目链接: LeetCode 169 — Majority Element AC代码:public class Problem169 { public int majorityElement(int[] nums) { int m=nums[0],n=0; for(int i=0;i<nums.length;i++){ if(num
2017-02-19 19:37:29 192
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人