Leecode 0004. Median of Two Sorted Arrays
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)). You may assume nums1 and nums2 cannot be both empty. Example 1: nums1 = [1, 3] nums2 = [2] The median is 2.0 Example 2: nums1 = [1, 2] nums2 = [3, 4] The median is (2 + 3)/2 = 2.5 题目大意给定两个大小为 m 和 n 的有序数组 nums1 和 nums2。 请你找出这两个有序数组的中位数,并且要求算法的时间复杂度为 O(log(m +...
Leecode 0003. Longest Substring Without Repeating Characters
3. Longest Substring Without Repeating Characters题目Given a string, find the length of the longest substring without repeating characters. Example 1: 123Input: "abcabcbb"Output: 3 Explanation: The answer is "abc", with the length of 3. Example 2: 123Input: "bbbbb"Output: 1Explanation: The answer is "b", with the length of 1. Example 3: 1234Input: "pwwkew"Output: 3Explanation: The answer is "wke", with the length of 3. ...
Leecode 0002. Add Two Numbers
2. Add Two Numbers题目You are given two non-empty linked lists representing two non-negative integers. The digits are stored in reverse order, and each of their nodes contains a single digit. Add the two numbers and return the sum as a linked list. You may assume the two numbers do not contain any leading zeros, except the number 0 itself. Example 1: 123Input: l1 = [2,4,3], l2 = [5,6,4]Output: [7,0,8]Explanation: 342 + 465 = 807. Example 2: 12Input: l1 = [0], l2 = [0]Output: [0] Example...