原文链接: https://leetcode-cn.com/problems/dungeon-game 英文原文The demons had captured the princess and imprisoned her in the bottom-right corner of a dungeon. The dungeon consists of m x n rooms laid out in a 2D grid. Our valiant knight was initially posit…
分类详情
困难 分类
原文链接: https://leetcode-cn.com/problems/department-top-three-salaries 英文原文Table: Employee +--------------+---------+ | Column Name | Type | +--------------+---------+ | id | int | | name | varchar | | salary | int | | departmentId | int | +-----------…
原文链接: https://leetcode-cn.com/problems/best-time-to-buy-and-sell-stock-iv 英文原文You are given an integer array prices where prices[i] is the price of a given stock on the ith day, and an integer k. Find the maximum profit you can achieve. You may compl…
原文链接: https://leetcode-cn.com/problems/word-search-ii 英文原文Given an m x n board of characters and a list of strings words, return all words on the board. Each word must be constructed from letters of sequentially adjacent cells, where adjacent cells a…
原文链接: https://leetcode-cn.com/problems/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 …
原文链接: https://leetcode-cn.com/problems/basic-calculator 英文原文Given a string s representing a valid expression, implement a basic calculator to evaluate it, and return the result of the evaluation. Note: You are not allowed to use any built-in function…
原文链接: https://leetcode-cn.com/problems/number-of-digit-one 英文原文Given an integer n, count the total number of digit 1 appearing in all non-negative integers less than or equal to n. Example 1: Input: n = 13 Output: 6 Example 2: Input: n = 0 Output: 0 …
原文链接: https://leetcode-cn.com/problems/sliding-window-maximum 英文原文You are given an array of integers nums, there is a sliding window of size k which is moving from the very left of the array to the very right. You can only see the k numbers in the wi…
原文链接: https://leetcode-cn.com/problems/trips-and-users 英文原文Table: Trips +-------------+----------+ | Column Name | Type | +-------------+----------+ | id | int | | client_id | int | | driver_id | int | | city_id | int | | status | enum | | request_at…
原文链接: https://leetcode-cn.com/problems/integer-to-english-words 英文原文Convert a non-negative integer num to its English words representation. Example 1: Input: num = 123 Output: "One Hundred Twenty Three" Example 2: Input: num = 12345 Output: "Twelve T…
原文链接: https://leetcode-cn.com/problems/expression-add-operators 英文原文Given a string num that contains only digits and an integer target, return all possibilities to insert the binary operators '+', '-', and/or '*' between the digits of num so that the…
原文链接: https://leetcode-cn.com/problems/find-median-from-data-stream 英文原文The median is the middle value in an ordered integer list. If the size of the list is even, there is no middle value and the median is the mean of the two middle values. For exam…
原文链接: https://leetcode-cn.com/problems/serialize-and-deserialize-binary-tree 英文原文Serialization is the process of converting a data structure or object into a sequence of bits so that it can be stored in a file or memory buffer, or transmitted across …
原文链接: https://leetcode-cn.com/problems/remove-invalid-parentheses 英文原文Given a string s that contains parentheses and letters, remove the minimum number of invalid parentheses to make the input string valid. Return all the possible results. You may re…
原文链接: https://leetcode-cn.com/problems/burst-balloons 英文原文You are given n balloons, indexed from 0 to n - 1. Each balloon is painted with a number on it represented by an array nums. You are asked to burst all the balloons. If you burst the ith ballo…
原文链接: https://leetcode-cn.com/problems/count-of-smaller-numbers-after-self 英文原文You are given an integer array nums and you have to return a new counts array. The counts array has the property where counts[i] is the number of smaller elements to the r…
原文链接: https://leetcode-cn.com/problems/create-maximum-number 英文原文You are given two integer arrays nums1 and nums2 of lengths m and n respectively. nums1 and nums2 represent the digits of two numbers. You are also given an integer k. Create the maximu…
原文链接: https://leetcode-cn.com/problems/count-of-range-sum 英文原文Given an integer array nums and two integers lower and upper, return the number of range sums that lie in [lower, upper] inclusive. Range sum S(i, j) is defined as the sum of the elements …
原文链接: https://leetcode-cn.com/problems/longest-increasing-path-in-a-matrix 英文原文Given an m x n integers matrix, return the length of the longest increasing path in matrix. From each cell, you can either move in four directions: left, right, up, or dow…
原文链接: https://leetcode-cn.com/problems/patching-array 英文原文Given a sorted integer array nums and an integer n, add/patch elements to the array such that any number in the range [1, n] inclusive can be formed by the sum of some elements in the array. R…
原文链接: https://leetcode-cn.com/problems/reconstruct-itinerary 英文原文You are given a list of airline tickets where tickets[i] = [fromi, toi] represent the departure and the arrival airports of one flight. Reconstruct the itinerary in order and return it.…
原文链接: https://leetcode-cn.com/problems/palindrome-pairs 英文原文Given a list of unique words, return all the pairs of the distinct indices (i, j) in the given list, so that the concatenation of the two words words[i] + words[j] is a palindrome. Example 1…
原文链接: https://leetcode-cn.com/problems/data-stream-as-disjoint-intervals 英文原文Given a data stream input of non-negative integers a1, a2, ..., an, summarize the numbers seen so far as a list of disjoint intervals. Implement the SummaryRanges class: Sum…
原文链接: https://leetcode-cn.com/problems/russian-doll-envelopes 英文原文You are given a 2D array of integers envelopes where envelopes[i] = [wi, hi] represents the width and the height of an envelope. One envelope can fit into another if and only if both t…
原文链接: https://leetcode-cn.com/problems/max-sum-of-rectangle-no-larger-than-k 英文原文Given an m x n matrix matrix and an integer k, return the max sum of a rectangle in the matrix such that its sum is no larger than k. It is guaranteed that there will be…
原文链接: https://leetcode-cn.com/problems/insert-delete-getrandom-o1-duplicates-allowed 英文原文RandomizedCollection is a data structure that contains a collection of numbers, possibly duplicates (i.e., a multiset). It should support inserting and removing …
原文链接: https://leetcode-cn.com/problems/perfect-rectangle 英文原文Given an array rectangles where rectangles[i] = [xi, yi, ai, bi] represents an axis-aligned rectangle. The bottom-left point of the rectangle is (xi, yi) and the top-right point of it is (a…
原文链接: https://leetcode-cn.com/problems/frog-jump 英文原文A frog is crossing a river. The river is divided into some number of units, and at each unit, there may or may not exist a stone. The frog can jump on a stone, but it must not jump into the water. …
原文链接: https://leetcode-cn.com/problems/trapping-rain-water-ii 英文原文Given an m x n integer matrix heightMap representing the height of each unit cell in a 2D elevation map, return the volume of water it can trap after raining. Example 1: Input: heightM…
原文链接: https://leetcode-cn.com/problems/split-array-largest-sum 英文原文Given an array nums which consists of non-negative integers and an integer m, you can split the array into m non-empty continuous subarrays. Write an algorithm to minimize the largest…