上一页 1 ··· 7 8 9 10 11 12 13 14 15 ··· 22 下一页
摘要: class Solution { public int uniquePathsWithObstacles(int[][] obstacleGrid) { for(int i=0;i=0?1:0; for(int i=0;i=0) obstacleGrid[i][j]+=(i>0&&obstacleGrid[i-1][... 阅读全文
posted @ 2017-09-26 04:56 Weiyu Wang 阅读(133) 评论(0) 推荐(0) 编辑
摘要: class Solution { public int uniquePaths(int m, int n) { int[][] dp=new int[m][n]; dp[0][0]=1; for(int i=0;i0?dp[i-1][j]:0)+(j>0?dp[i][j-1]:0); return dp[m-1][n-1];... 阅读全文
posted @ 2017-09-26 04:47 Weiyu Wang 阅读(75) 评论(0) 推荐(0) 编辑
摘要: class Solution { public ListNode rotateRight(ListNode head, int k) { ListNode preNode=new ListNode(0); preNode.next=head; ListNode p=preNode; int len=0; wh... 阅读全文
posted @ 2017-09-26 04:37 Weiyu Wang 阅读(109) 评论(0) 推荐(0) 编辑
摘要: Base on next permutation: 阅读全文
posted @ 2017-09-26 03:56 Weiyu Wang 阅读(134) 评论(0) 推荐(0) 编辑
摘要: class Solution { public int[][] generateMatrix(int n) { int[][] matrix=new int[n][n]; generateMatrix(0, 0, 0, n-1, n-1, matrix); return matrix; } private void gene... 阅读全文
posted @ 2017-09-26 02:25 Weiyu Wang 阅读(116) 评论(0) 推荐(0) 编辑
摘要: class Solution { public List insert(List intervals, Interval newInterval) { int idx=0; while(idx res=new ArrayList(); int start=intervals.get(0).start; int end=int... 阅读全文
posted @ 2017-09-26 02:11 Weiyu Wang 阅读(124) 评论(0) 推荐(0) 编辑
摘要: class Solution { public List merge(List intervals) { List res=new ArrayList(); if(intervals.size()==0) return res; Collections.sort(intervals, (a,b)->a.start-b... 阅读全文
posted @ 2017-09-26 02:00 Weiyu Wang 阅读(118) 评论(0) 推荐(0) 编辑
摘要: public class Solution { public boolean canJump(int[] nums) { int maxDistance=0; for(int i=0;i=nums.length-1) return true; } return false; ... 阅读全文
posted @ 2017-09-26 01:49 Weiyu Wang 阅读(136) 评论(0) 推荐(0) 编辑
摘要: public class Solution { public List spiralOrder(int[][] matrix) { List res=new ArrayList(); if(matrix.length==0||matrix[0].length==0) return res; spiralOrder(0... 阅读全文
posted @ 2017-09-26 01:44 Weiyu Wang 阅读(126) 评论(0) 推荐(0) 编辑
摘要: class Solution { public int totalNQueens(int n) { int[][] board=new int[n][n]; return totalNQueens(0, board); } private int totalNQueens(int i, int[][] board) { ... 阅读全文
posted @ 2017-09-26 01:12 Weiyu Wang 阅读(152) 评论(0) 推荐(0) 编辑
上一页 1 ··· 7 8 9 10 11 12 13 14 15 ··· 22 下一页