原文链接: https://leetcode-cn.com/problems/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 o…
标签详情
动态规划 分类
原文链接: https://leetcode-cn.com/problems/generate-parentheses 英文原文Given n pairs of parentheses, write a function to generate all combinations of well-formed parentheses. Example 1: Input: n = 3 Output: ["((()))","(()())","(())()","()(())","()()()"] Exa…
原文链接: https://leetcode-cn.com/problems/longest-valid-parentheses 英文原文Given a string containing just the characters '(' and ')', find the length of the longest valid (well-formed) parentheses substring. Example 1: Input: s = "(()" Output: 2 Explanatio…
原文链接: https://leetcode-cn.com/problems/trapping-rain-water 英文原文Given n non-negative integers representing an elevation map where the width of each bar is 1, compute how much water it can trap after raining. Example 1: Input: height = [0,1,0,2,1,0,1,3…
原文链接: https://leetcode-cn.com/problems/wildcard-matching 英文原文Given an input string (s) and a pattern (p), implement wildcard pattern matching with support for '?' and '*' where: '?' Matches any single character. '*' Matches any sequence of characters…
原文链接: https://leetcode-cn.com/problems/jump-game-ii 英文原文Given an array of non-negative integers nums, you are initially positioned at the first index of the array. Each element in the array represents your maximum jump length at that position. Your g…
原文链接: https://leetcode-cn.com/problems/maximum-subarray 英文原文Given an integer array nums, find the contiguous subarray (containing at least one number) which has the largest sum and return its sum. A subarray is a contiguous part of an array. Example …
原文链接: https://leetcode-cn.com/problems/jump-game 英文原文You are given an integer array nums. You are initially positioned at the array's first index, and each element in the array represents your maximum jump length at that position. Return true if you …
原文链接: https://leetcode-cn.com/problems/unique-paths 英文原文A robot is located at the top-left corner of a m x n grid (marked 'Start' in the diagram below). The robot can only move either down or right at any point in time. The robot is trying to reach t…
原文链接: https://leetcode-cn.com/problems/unique-paths-ii 英文原文A robot is located at the top-left corner of a m x n grid (marked 'Start' in the diagram below). The robot can only move either down or right at any point in time. The robot is trying to reac…
原文链接: https://leetcode-cn.com/problems/minimum-path-sum 英文原文Given a m x n grid filled with non-negative numbers, find a path from top left to bottom right, which minimizes the sum of all numbers along its path. Note: You can only move either down or …
原文链接: https://leetcode-cn.com/problems/climbing-stairs 英文原文You are climbing a staircase. It takes n steps to reach the top. Each time you can either climb 1 or 2 steps. In how many distinct ways can you climb to the top? Example 1: Input: n = 2 Outpu…
原文链接: https://leetcode-cn.com/problems/edit-distance 英文原文Given two strings word1 and word2, return the minimum number of operations required to convert word1 to word2. You have the following three operations permitted on a word: Insert a character De…
原文链接: https://leetcode-cn.com/problems/maximal-rectangle 英文原文Given a rows x cols binary matrix filled with 0's and 1's, find the largest rectangle containing only 1's and return its area. Example 1: Input: matrix = [["1","0","1","0","0"],["1","0","1"…
原文链接: https://leetcode-cn.com/problems/scramble-string 英文原文We can scramble a string s to get a string t using the following algorithm: If the length of the string is 1, stop. If the length of the string is > 1, do the following: Split the string into…
原文链接: https://leetcode-cn.com/problems/decode-ways 英文原文A message containing letters from A-Z can be encoded into numbers using the following mapping: 'A' -> "1" 'B' -> "2" ... 'Z' -> "26" To decode an encoded message, all the digits must be grouped t…
原文链接: https://leetcode-cn.com/problems/unique-binary-search-trees-ii 英文原文Given an integer n, return all the structurally unique BST's (binary search trees), which has exactly n nodes of unique values from 1 to n. Return the answer in any order. Examp…
原文链接: https://leetcode-cn.com/problems/unique-binary-search-trees 英文原文Given an integer n, return the number of structurally unique BST's (binary search trees) which has exactly n nodes of unique values from 1 to n. Example 1: Input: n = 3 Output: 5 E…
原文链接: https://leetcode-cn.com/problems/interleaving-string 英文原文Given strings s1, s2, and s3, find whether s3 is formed by an interleaving of s1 and s2. An interleaving of two strings s and t is a configuration where they are divided into non-empty su…
原文链接: https://leetcode-cn.com/problems/distinct-subsequences 英文原文Given two strings s and t, return the number of distinct subsequences of s which equals t. A string's subsequence is a new string formed from the original string by deleting some (can b…
原文链接: https://leetcode-cn.com/problems/pascals-triangle 英文原文Given an integer numRows, return the first numRows of Pascal's triangle. In Pascal's triangle, each number is the sum of the two numbers directly above it as shown: Example 1: Input: numRows…
原文链接: https://leetcode-cn.com/problems/pascals-triangle-ii 英文原文Given an integer rowIndex, return the rowIndexth (0-indexed) row of the Pascal's triangle. In Pascal's triangle, each number is the sum of the two numbers directly above it as shown: Exam…
原文链接: https://leetcode-cn.com/problems/triangle 英文原文Given a triangle array, return the minimum path sum from top to bottom. For each step, you may move to an adjacent number of the row below. More formally, if you are on index i on the current row, y…
原文链接: https://leetcode-cn.com/problems/best-time-to-buy-and-sell-stock 英文原文You are given an array prices where prices[i] is the price of a given stock on the ith day. You want to maximize your profit by choosing a single day to buy one stock and choo…
原文链接: https://leetcode-cn.com/problems/best-time-to-buy-and-sell-stock-iii 英文原文You are given an array prices where prices[i] is the price of a given stock on the ith day. Find the maximum profit you can achieve. You may complete at most two transacti…
原文链接: https://leetcode-cn.com/problems/best-time-to-buy-and-sell-stock-ii 英文原文You are given an integer array prices where prices[i] is the price of a given stock on the ith day. On each day, you may decide to buy and/or sell the stock. You can only h…
原文链接: https://leetcode-cn.com/problems/binary-tree-maximum-path-sum 英文原文A path in a binary tree is a sequence of nodes where each pair of adjacent nodes in the sequence has an edge connecting them. A node can only appear in the sequence at most once.…
原文链接: https://leetcode-cn.com/problems/palindrome-partitioning 英文原文Given a string s, partition s such that every substring of the partition is a palindrome. Return all possible palindrome partitioning of s. A palindrome string is a string that reads …
原文链接: https://leetcode-cn.com/problems/palindrome-partitioning-ii 英文原文Given a string s, partition s such that every substring of the partition is a palindrome. Return the minimum cuts needed for a palindrome partitioning of s. Example 1: Input: s = "…
原文链接: https://leetcode-cn.com/problems/word-break 英文原文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 …
1 / 12