摘要: There are two sorted arraysnums1andnums2of size m and n respectively. Find the median of the two sorted arrays. The overall run time complexity should... 阅读全文
posted @ 2015-07-04 16:09 ~每天进步一点点~ 阅读(157) 评论(0) 推荐(0) 编辑
摘要: Given a string, find the length of the longest substring without repeating characters. For example, the longest substring without repeating letters fo... 阅读全文
posted @ 2015-07-04 14:03 ~每天进步一点点~ 阅读(121) 评论(0) 推荐(0) 编辑
摘要: You are given two linked lists representing two non-negative numbers. The digits are stored in reverse order and each of their nodes contain a single ... 阅读全文
posted @ 2015-07-03 23:46 ~每天进步一点点~ 阅读(149) 评论(0) 推荐(0) 编辑
摘要: Given an array of integers, find two numbers such that they add up to a specific target number.The function twoSum should return indices of the two nu... 阅读全文
posted @ 2015-07-03 23:16 ~每天进步一点点~ 阅读(127) 评论(0) 推荐(0) 编辑
摘要: After robbing those houses on that street, the thief has found himself a new place for his thievery so that he will not get too much attention. This t... 阅读全文
posted @ 2015-07-03 21:46 ~每天进步一点点~ 阅读(231) 评论(0) 推荐(0) 编辑
摘要: public class SecondMax { /** * @param args */ public static void main(String[] args) { // TODO Auto-generated method stub ... 阅读全文
posted @ 2015-07-03 16:55 ~每天进步一点点~ 阅读(199) 评论(0) 推荐(0) 编辑
摘要: 一个全是数字的大数组,除了其中一个数字出现2次外,其余的数字都出现了3次。如何找出那个只出现了两次的数字?其中ones记录了所有出现了模3余1次的bit,twos记录的是余2的。not_threes是当一个bit出现第3次的时候,把它清掉。public class Test3in2 { /**... 阅读全文
posted @ 2015-07-02 16:47 ~每天进步一点点~ 阅读(345) 评论(0) 推荐(0) 编辑
摘要: 双指针思路,循环时,声明一个变量保存范围起始的下标注意:如何在数组只有一个元素,还有遍历到最后一个元素的时候,去更新结果集。public class Solution { public List summaryRanges(int[] nums) { List res=new A... 阅读全文
posted @ 2015-06-28 22:46 ~每天进步一点点~ 阅读(150) 评论(0) 推荐(0) 编辑
摘要: public class Singleton {//饿汉模式 public String name; private static Singleton instance=new Singleton(); private Singleton(){} public static ... 阅读全文
posted @ 2015-06-17 11:14 ~每天进步一点点~ 阅读(174) 评论(0) 推荐(0) 编辑
摘要: public class Solution { public int findKthLargest(int[] nums, int k) { return find(nums,nums.length-k,0,nums.length-1); } public int f... 阅读全文
posted @ 2015-05-31 17:04 ~每天进步一点点~ 阅读(140) 评论(0) 推荐(0) 编辑