2016年2月1日

摘要: If given a function that generates a random number from 1 to 5, how do you use this function to generate a random number from 1 to 7 with the same pro 阅读全文
posted @ 2016-02-01 12:09 marc_java 阅读(228) 评论(0) 推荐(0)
 
摘要: [ 12 | 2434 | 23 | 1 | 654 | 222 | 56 | 100000 ] Then the output should be: [ 1 | 100000 | 12 | 222 | 23 | 2434 | 56 | 654 ] 建立自己的comparator: Comparat 阅读全文
posted @ 2016-02-01 12:05 marc_java 阅读(274) 评论(0) 推荐(0)

2016年1月18日

摘要: public ListNode reverseBetween(ListNode head, int m, int n) { if(head==null) return head; ListNode slow = head; ListNode f... 阅读全文
posted @ 2016-01-18 14:46 marc_java 阅读(1450) 评论(0) 推荐(0)
 
摘要: https://leetcode.com/problems/search-a-2d-matrix-ii/巧解题,矩阵本身等于了一个binary search tree,从中值开始走时间复杂度 O(m+n)public boolean searchMatrix(int[][] matrix, int ... 阅读全文
posted @ 2016-01-18 14:05 marc_java 阅读(281) 评论(0) 推荐(0)
 
摘要: 遍历,一共有三种情况,1. pre tail 或者 xcurrent.val && (last.val<x || x<=current.val)) { insertbtw(last,current,x); ... 阅读全文
posted @ 2016-01-18 13:09 marc_java 阅读(416) 评论(0) 推荐(0)