摘要: 做这题花了四个小时,学习到了使用二分查找,代码可以扩展至“在两个有序数组中找到第K个元素”。 因为有O(log(m+n))的要求,我们不能简单使用扫描数组然后取中位数的形式,这要求我们使用复杂度为log(n) 的二分查找。 梳理题目条件:不考虑特殊情况,且假设nums1 元素个数 小于 nums2, 阅读全文
posted @ 2018-12-22 12:16 andrew-chen 阅读(131) 评论(0) 推荐(0) 编辑
摘要: Given a string, find the length of the longest substring without repeating characters. Example 1: Input: "abcabcbb" Output: 3 Explanation: The answer 阅读全文
posted @ 2018-12-22 11:52 andrew-chen 阅读(118) 评论(0) 推荐(0) 编辑