摘要: 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) 编辑