上一页 1 ··· 9 10 11 12 13 14 15 16 17 ··· 22 下一页
摘要: https://leetcode.com/problems/restore-ip-addresses/discuss/30944/Very-simple-DFS-solution 阅读全文
posted @ 2018-09-17 04:01 jasoncool1 阅读(115) 评论(0) 推荐(0) 编辑
摘要: 1 class Solution { 2 public ListNode reverseBetween(ListNode head, int m, int n) { 3 ListNode node1 = head; 4 // int len = 0; //可以不用加 5 // while(node1 != nu... 阅读全文
posted @ 2018-09-17 01:01 jasoncool1 阅读(87) 评论(0) 推荐(0) 编辑
摘要: https://leetcode.com/problems/gray-code/discuss/29893/One-liner-Python-solution-(with-demo-in-comments) 阅读全文
posted @ 2018-09-16 23:55 jasoncool1 阅读(93) 评论(0) 推荐(0) 编辑
摘要: 1 class Solution { 2 public void merge(int[] nums1, int m, int[] nums2, int n) { 3 int[] res = new int[m + n]; 4 int pos = 0; 5 int i = 0, j = 0; 6 while(i =... 阅读全文
posted @ 2018-09-16 11:07 jasoncool1 阅读(107) 评论(0) 推荐(0) 编辑
摘要: 1 class Solution { 2 public ListNode partition(ListNode head, int x) { 3 ListNode newHead = null; 4 ListNode node2 = null; 5 ListNode node1 = head; 6 whi... 阅读全文
posted @ 2018-09-16 10:38 jasoncool1 阅读(105) 评论(0) 推荐(0) 编辑
摘要: 1 class Solution { 2 public ListNode deleteDuplicates(ListNode head) { 3 if(head == null || head.next == null) return head; 4 ListNode node1 = head; 5 ListNode node2 ... 阅读全文
posted @ 2018-09-16 10:06 jasoncool1 阅读(116) 评论(0) 推荐(0) 编辑
摘要: pre.next设置成下一个数字的第一个 下一个数字进行循环 循环到相同的数字的最后一个 要是pre.next = node1 说明只有unique pre=pre.next, 否则说明不unique pre.next设置成下一个数字的第一个 就是pre.next = node1.next http 阅读全文
posted @ 2018-09-16 03:13 jasoncool1 阅读(90) 评论(0) 推荐(0) 编辑
摘要: 1 class Solution { 2 public boolean search(int[] nums, int target) { 3 if(nums.length == 0) return false; 4 int lo = 0, hi = nums.length-1; 5 while(lo target && targ... 阅读全文
posted @ 2018-09-16 00:08 jasoncool1 阅读(143) 评论(0) 推荐(0) 编辑
摘要: 1 class Solution { 2 public int removeDuplicates(int[] nums) { 3 if(nums.length == 0) return 0; 4 if(nums.length == 1) return 1; 5 int i = 1, j = 1; 6 int co... 阅读全文
posted @ 2018-09-15 22:59 jasoncool1 阅读(129) 评论(0) 推荐(0) 编辑
摘要: 1 class Solution { 2 List> res = new ArrayList(); 3 public List> combine(int n, int k) { 4 if(k == 0) return null; 5 int[] nums = new int[n]; 6 for(int i = 0; i ... 阅读全文
posted @ 2018-09-15 22:27 jasoncool1 阅读(107) 评论(0) 推荐(0) 编辑
上一页 1 ··· 9 10 11 12 13 14 15 16 17 ··· 22 下一页