Monthly Archives: July 2016

  1. 533. Two Sum Closest

    Leave a comment

    July 10, 2016 by oneOokay

    Two pointers + Sort public int twoSumCloset(int[] nums, int target) { // Write your code here if (nums == null …
    Continue reading

  2. ___56. Two Sum

    Leave a comment

    July 10, 2016 by oneOokay

    比较妙的一个解法吧,要我自己想我想不出来。 HashMap store: target – nums[i] and index:i for-loop: if nums[i] doesn’t exist in HashMap’s key, add (target – nums[i], …
    Continue reading

  3. Merge sorted array

    Leave a comment

    July 2, 2016 by oneOokay

    Given two sorted integer arrays nums1 and nums2, merge nums2 into nums1 as one sorted array. Note: You may assume …
    Continue reading

  4. 547. Intersection of Two Arrays

    Leave a comment

    July 2, 2016 by oneOokay

    Solve it in three algorithms: hashmap; 2. two pointers; 3. binary search. My very naive way: (BAD really BAD) (HashSet) …
    Continue reading