Leetcode 0003: Longest Substring Without Repeating Characters

题目描述:Given a string s, find the length of the longest substring without repeating characters.Example 1:Input: s = “abcabcbb”Output: 3Explanation: The answer is “abc”, with the length of 3.Example 2:Input: s = “bbbbb”Output: 1Explanation: The
分类: 其他 发布时间: 02-27 13:53 阅读次数: 0

Leetcode 0004: Median of Two Sorted Arrays

题目描述:Given two sorted arrays nums1 and nums2 of size m and n respectively, return the median of the two sorted arrays.Follow up: The overall run time complexity should be O(log (m+n)).Example 1:Input: nums1 = [1,3], nums2 = [2]Output: 2.00000Expla
分类: 其他 发布时间: 02-27 13:53 阅读次数: 0

Leetcode 题目汇总

Leetcode 题目汇总持续更新题号题目难度0001两数之和 Two Sum简单0002两数相加 Add Two Numbers中等0003无重复字符的最长子串 Longest Substring Without Repeating Characters中等0004寻找两个正序数组的中位数 Median of Two Sorted Arrays困难...
分类: 其他 发布时间: 02-27 13:52 阅读次数: 0

Leetcode 0005: Longest Palindromic Substring

题目描述:Given a string s, return the longest palindromic substring in s.Example 1:Input: s = “babad”Output: “bab”Note: “aba” is also a valid answer.Example 2:Input: s = “cbbd”Output: “bb”Example 3:Input: s = “a”Output: “a”Example 4:Input
分类: 其他 发布时间: 02-27 13:52 阅读次数: 0

Leetcode 0006: ZigZag Conversion

题目描述:The string “PAYPALISHIRING” is written in a zigzag pattern on a given number of rows like this: (you may want to display this pattern in a fixed font for better legibility)P _ A _ H _ NA P L S I I GY _ I _ R _ _And then read line by line:
分类: 其他 发布时间: 02-27 13:52 阅读次数: 0

Leetcode 0007: Reverse Integer

题目描述:Given a signed 32-bit integer x, return x with its digits reversed. If reversing x causes the value to go outside the signed 32-bit integer range [-231, 231 - 1], then return 0.Assume the environment does not allow you to store 64-bit integers (sig
分类: 其他 发布时间: 02-27 13:52 阅读次数: 0

Leetcode 0215: Kth Largest Element in an Array

题目描述:Find the kth largest element in an unsorted array. Note that it is the kth largest element in the sorted order, not the kth distinct element.Example 1:Input: [3,2,1,5,6,4] and k = 2Output: 5Example 2:Input: [3,2,3,1,2,4,5,5,6] and k = 4Out
分类: 其他 发布时间: 02-27 13:51 阅读次数: 0

Leetcode 0008: String to Integer (atoi)

题目描述:Implement the myAtoi(string s) function, which converts a string to a 32-bit signed integer (similar to C/C++'s atoi function).The algorithm for myAtoi(string s) is as follows:Read in and ignore any leading whitespace.Check if the next character
分类: 其他 发布时间: 02-27 13:51 阅读次数: 0

Leetcode 0009: Palindrome Number

题目描述:Given an integer x, return true if x is palindrome integer.An integer is a palindrome when it reads the same backward as forward. For example, 121 is palindrome while 123 is not.Note:Input: x = 121Output: trueExample 1:Input: s = “42”Outp
分类: 其他 发布时间: 02-27 13:51 阅读次数: 0

Leetcode 0011: Container With Most Water

题目描述:Given an input string (s) and a pattern §, implement regular expression matching with support for ‘.’ and ‘’ where:‘.’ Matches any single character.​​​​'’ Matches zero or more of the preceding element.The matching should cover the entire input st
分类: 其他 发布时间: 02-27 13:51 阅读次数: 0

Leetcode 0216: Combination Sum III

题目描述:Find all valid combinations of k numbers that sum up to n such that the following conditions are true:Only numbers 1 through 9 are used.Each number is used at most once.Return a list of all possible valid combinations. The list must not contain t
分类: 其他 发布时间: 02-27 13:50 阅读次数: 0

Leetcode 0010: Regular Expression Matching

题目描述:Given an input string s and a pattern p, implement regular expression matching with support for ’ . ’ and ‘ * ‘ where:‘.’ Matches any single character.​​​​‘*’ Matches zero or more of the preceding element.The matching should cover the entire inp
分类: 其他 发布时间: 02-27 13:50 阅读次数: 0

Leetcode 0218: The Skyline Problem

题目描述:A city’s skyline is the outer contour of the silhouette formed by all the buildings in that city when viewed from a distance. Given the locations and heights of all the buildings, return the skyline formed by these buildings collectively.The geom
分类: 其他 发布时间: 02-27 13:50 阅读次数: 0

Leetcode 0220: Contains Duplicate III

题目描述:Given an array of integers, find out whether there are two distinct indices i and j in the array such that the absolute difference between nums[i] and nums[j] is at most t and the absolute difference between i and j is at most k.中文描述:Example 1:
分类: 其他 发布时间: 02-27 13:50 阅读次数: 0

Leetcode 0221: Maximal Square

题目描述:Given an m x n binary matrix filled with 0’s and 1’s, find the largest square containing only 1’s and return its area.Example 1:Input: matrix = [[“1”,“0”,“1”,“0”,“0”],[“1”,“0”,“1”,“1”,“1”],[“1”,“1”,“1”,“1”,“1”],[“1”,“0”,“0”,“1”,“0”]]Output: 4
分类: 其他 发布时间: 02-27 13:49 阅读次数: 0

Leetcode 0222: Count Complete Tree Nodes

题目描述:Given the root of a complete binary tree, return the number of the nodes in the tree.According to Wikipedia, every level, except possibly the last, is completely filled in a complete binary tree, and all nodes in the last level are as far left as p
分类: 其他 发布时间: 02-27 13:49 阅读次数: 0

Leetcode 0224: Basic Calculator

题目描述:Given a string s representing an expression, implement a basic calculator to evaluate it.Example 1:Input: s = “1 + 1”Output: 2Example 2:Input: s = " 2-1 + 2 "Output: 3Example 3:Input: s = " 2-1 + 2 "Output: 3Constraints:1 <= s.
分类: 其他 发布时间: 02-27 13:49 阅读次数: 0

Leetcode 0229: Majority Element II

题目描述:Given an integer array of size n, find all elements that appear more than ⌊ n/3 ⌋ times.Follow-up: Could you solve the problem in linear time and in O(1) space?Example 1:Input: nums = [3,2,3]Output: [3]Example 2:Input: nums = [1]Output: [
分类: 其他 发布时间: 02-27 13:48 阅读次数: 0

Leetcode 0225: Implement Stack using Queues

题目描述:Implement a last in first out (LIFO) stack using only two queues. The implemented stack should support all the functions of a normal queue (push, top, pop, and empty).Implement the MyStack class:void push(int x) Pushes element x to the top of the
分类: 其他 发布时间: 02-27 13:48 阅读次数: 0

Leetcode 0250: Count Univalue Subtrees

题目描述:Given the root of a binary tree, return the number of uni-value subtrees.A uni-value subtree means all nodes of the subtree have the same value.Example 1:Input: root = [5,1,5,5,5,null,5]Output: 4Example 2:Input: root = [5,5,5,5,5,null,5]
分类: 其他 发布时间: 02-27 13:48 阅读次数: 0