随笔分类 -  array (two pointers)

454. 4Sum II
摘要:Given four lists A, B, C, D of integer values, compute how many tuples (i, j, k, l) there are such that A[i] + B[j] + C[k] + D[l] is zero. To make problem a bit easier, all A, B, C, D have same leng... 阅读全文

posted @ 2018-11-09 10:18 猪猪🐷

18. 4Sum
摘要:Given an array nums of n integers and an integer target, are there elements a, b, c, and d in nums such that a + b + c + d = target? Find all unique q 阅读全文

posted @ 2018-07-18 08:31 猪猪🐷

259. 3Sum Smaller
摘要:Given an array of n integers nums and a target, find the number of index triplets i, j, k with 0 <= i < j < k < n that satisfy the condition nums[i] + 阅读全文

posted @ 2018-07-18 08:30 猪猪&#128055;

16. 3Sum Closest
摘要:Given an array nums of n integers and an integer target, find three integers in nums such that the sum is closest to target. Return the sum of the thr 阅读全文

posted @ 2018-07-18 08:29 猪猪&#128055;

15. 3Sum
摘要:3 sum with/ without deduplication 3sum FB超级喜欢问这道题,所以务必sort和hash table的解法都烂熟于心,也问了时间和空间复杂度。4sum hashmap Given an array nums of n integers, are there el 阅读全文

posted @ 2018-07-18 08:28 猪猪&#128055;

167. Two Sum II - Input array is sorted
摘要:Given an array of integers that is already sorted in ascending order, find two numbers such that they add up to a specific target number. The function 阅读全文

posted @ 2018-07-18 08:27 猪猪&#128055;

1. Two Sum
摘要:(hashmap && two pointers ) Given an array of integers, return indices of the two numbers such that they add up to a specific target. You may assume th 阅读全文

posted @ 2018-07-18 08:26 猪猪&#128055;

导航