上一页 1 ··· 10 11 12 13 14 15 16 17 18 ··· 22 下一页
摘要: 1 class Solution { 2 public void sortColors(int[] nums) { 3 if(nums == null || nums.length == 0) return; 4 int count0 = 0; 5 int count1 = 0; 6 int count2 = 0... 阅读全文
posted @ 2018-09-15 12:23 jasoncool1 阅读(88) 评论(0) 推荐(0) 编辑
摘要: 用Binary search 先搜索row 再搜索col 阅读全文
posted @ 2018-09-15 11:52 jasoncool1 阅读(108) 评论(0) 推荐(0) 编辑
摘要: 可以用String.join 方法 String.join("/", stack);每个元素之间用"/"分开 阅读全文
posted @ 2018-09-14 11:53 jasoncool1 阅读(100) 评论(0) 推荐(0) 编辑
摘要: 1 class Solution { 2 public String addBinary(String a, String b) { 3 if(a.length() == 0 && b.length() == 0) return null; 4 StringBuilder sb1 = new StringBuilder(a); 5 ... 阅读全文
posted @ 2018-09-14 10:42 jasoncool1 阅读(145) 评论(0) 推荐(0) 编辑
摘要: 1 class Solution { 2 public int minPathSum(int[][] grid) { 3 if(grid == null) return 0; 4 int row = grid.length; 5 int col = grid[0].length; 6 int[][] res = ... 阅读全文
posted @ 2018-09-14 09:49 jasoncool1 阅读(107) 评论(0) 推荐(0) 编辑
摘要: 1 class Solution { 2 public int uniquePathsWithObstacles(int[][] obstacleGrid) { 3 if(obstacleGrid == null) return 0; 4 int row = obstacleGrid.length; 5 int col = obs... 阅读全文
posted @ 2018-09-14 09:12 jasoncool1 阅读(105) 评论(0) 推荐(0) 编辑
摘要: 1 class Solution { 2 public ListNode rotateRight(ListNode head, int k) { 3 if(head == null) return null; 4 int n = 0; 5 ListNode node1 = head; 6 ListNode las... 阅读全文
posted @ 2018-09-13 13:21 jasoncool1 阅读(96) 评论(0) 推荐(0) 编辑
摘要: 1 class Solution { 2 public int[] plusOne(int[] digits) { 3 int n = digits.length; 4 int[] res = new int[n+1]; 5 int carry = 0; 6 for(int i = n - 1; i >= 0; ... 阅读全文
posted @ 2018-09-13 11:52 jasoncool1 阅读(198) 评论(0) 推荐(0) 编辑
摘要: https://leetcode.com/problems/permutation-sequence/discuss/22508/An-iterative-solution-for-reference 阅读全文
posted @ 2018-09-13 11:08 jasoncool1 阅读(108) 评论(0) 推荐(0) 编辑
摘要: 跟spiral matrix类似 阅读全文
posted @ 2018-09-13 07:23 jasoncool1 阅读(115) 评论(0) 推荐(0) 编辑
上一页 1 ··· 10 11 12 13 14 15 16 17 18 ··· 22 下一页