全站内容
medium
139. Word Break
#Problem Given a string s and a dictionary of strings wordDict, return true if s can be segmented into a space-separated sequence of one or more dictionary words. Note that the same word in the dictionary may be reused multiple times in the …
11. Container With Most Water
#Problem You are given an integer array height of length n. There are n vertical lines drawn such that the two endpoints of the ith line are (i, 0) and (i, height[i]). Find two lines that together with the x-axis form a container, such that …
647. Palindromic Substrings
#Problem Given a string s, return the number of palindromic substrings in it. A string is a palindrome when it reads the same backward as forward. A substring is a contiguous sequence of characters within the string. …
133. Clone Graph
#Problem Given a reference of a node in a connected undirected graph. Return a deep copy (clone) of the graph. Each node in the graph contains a value (int) and a list (List[Node]) of its neighbors. c++ 复制 class Node { public int val; …
5. Longest Palindromic Substring
#Problem Given a string s, return the longest palindromic substring in s. A string is palindromic if it reads the same forward and backward. A substring is a contiguous non-empty sequence of characters within a string. …
540. Single Element in a Sorted Array
#Problem You are given a sorted array consisting of only integers where every element appears exactly twice, except for one element which appears exactly once. Return the single element that appears only once. Your solution must run in …
3. Longest Substring Without Repeating Characters
#Problem Given a string s, find the length of the longest substring without repeating characters. A substring is a contiguous non-empty sequence of characters within a string. …
128. Longest Consecutive Sequence
#Problem Given an unsorted array of integers nums, return the length of the longest consecutive elements sequence. You must write an algorithm that runs in O(n) time. https://leetcode.com/problems/longest-consecutive-sequence/ Example 1: …