
数组
文章平均质量分 50
柯森锎
92年的小学生
展开
-
LeetCode 4. Median of Two Sorted Arrays
题目描述 There are two sorted arrays nums1 and nums2 of size m and n respectively. Find the median of the two sorted arrays. The overall run time complexity should be O(log (m+n)). Example 1:原创 2016-09-21 23:27:18 · 323 阅读 · 0 评论 -
LeetCode 16. 3Sum Closest (Two-Pointer)
题目描述Given an array S of n integers, find three integers in S such that the sum is closest to a given number, target. Return the sum of the three integers. You may assume that each input would have exac原创 2016-10-23 17:59:20 · 390 阅读 · 0 评论 -
LeetCode 15. 3Sum (Medium)
题目描述Given an array S of n integers, are there elements a, b, c in S such that a + b + c = 0? Find all unique triplets in the array which gives the sum of zero.题目解析最直接的是三重循环; 由于要求去掉重复的答案,所以要先对nums排序;原创 2016-10-23 16:22:49 · 506 阅读 · 0 评论 -
LeetCode 18. 4Sum
题目描述Given an array S of n integers, are there elements a, b, c, and d in S such that a + b + c + d = target? Find all unique quadruplets in the array which gives the sum of target.Note: The solution se原创 2016-11-23 23:17:13 · 469 阅读 · 0 评论