原文链接: https://leetcode-cn.com/problems/cut-off-trees-for-golf-event 英文原文You are asked to cut off all the trees in a forest for a golf event. The forest is represented as an m x n matrix. In this matrix: 0 means the cell cannot be walked through. 1 re…
分类详情
困难 分类
原文链接: https://leetcode-cn.com/problems/24-game 英文原文You are given an integer array cards of length 4. You have four cards, each containing a number in the range [1, 9]. You should arrange the numbers on these cards in a mathematical expression using t…
原文链接: https://leetcode-cn.com/problems/redundant-connection-ii 英文原文In this problem, a rooted tree is a directed graph such that, there is exactly one node (the root) for which all other nodes are descendants of this node, plus every node has exactly …
原文链接: https://leetcode-cn.com/problems/maximum-sum-of-3-non-overlapping-subarrays 英文原文Given an integer array nums and an integer k, find three non-overlapping subarrays of length k with maximum sum and return them. Return the result as a list of indi…
原文链接: https://leetcode-cn.com/problems/stickers-to-spell-word 英文原文We are given n different types of stickers. Each sticker has a lowercase English word on it. You would like to spell out the given string target by cutting individual letters from your…
原文链接: https://leetcode-cn.com/problems/falling-squares 英文原文There are several squares being dropped onto the X-axis of a 2D plane. You are given a 2D integer array positions where positions[i] = [lefti, sideLengthi] represents the ith square with a si…
原文链接: https://leetcode-cn.com/problems/find-k-th-smallest-pair-distance 英文原文The distance of a pair of integers a and b is defined as the absolute difference between a and b. Given an integer array nums and an integer k, return the kth smallest distan…
原文链接: https://leetcode-cn.com/problems/count-different-palindromic-subsequences 英文原文Given a string s, return the number of different non-empty palindromic subsequences in s. Since the answer may be very large, return it modulo 109 + 7. A subsequence …
原文链接: https://leetcode-cn.com/problems/my-calendar-iii 英文原文A k-booking happens when k events have some non-empty intersection (i.e., there is some time that is common to all k events.) You are given some events [start, end), after each given event, r…
原文链接: https://leetcode-cn.com/problems/parse-lisp-expression 英文原文You are given a string expression representing a Lisp-like expression to return the integer value of. The syntax for these expressions is given as follows. An expression is either an in…
原文链接: https://leetcode-cn.com/problems/number-of-atoms 英文原文Given a string formula representing a chemical formula, return the count of each atom. The atomic element always starts with an uppercase character, then zero or more lowercase letters, repre…
原文链接: https://leetcode-cn.com/problems/cherry-pickup 英文原文You are given an n x n grid representing a field of cherries, each cell is one of three possible integers. 0 means the cell is empty, so you can pass through, 1 means the cell contains a cherry…
原文链接: https://leetcode-cn.com/problems/prefix-and-suffix-search 英文原文Design a special dictionary with some words that searchs the words in it by a prefix and a suffix. Implement the WordFilter class: WordFilter(string[] words) Initializes the object w…
原文链接: https://leetcode-cn.com/problems/contain-virus 英文原文A virus is spreading rapidly, and your task is to quarantine the infected area by installing walls. The world is modeled as an m x n binary grid isInfected, where isInfected[i][j] == 0 represen…
原文链接: https://leetcode-cn.com/problems/cracking-the-safe 英文原文There is a safe protected by a password. The password is a sequence of n digits where each digit can be in the range [0, k - 1]. The safe has a peculiar way of checking the password. When y…
原文链接: https://leetcode-cn.com/problems/set-intersection-size-at-least-two 英文原文An integer interval [a, b] (for integers a < b) is a set of all consecutive integers from a to b, including a and b. Find the minimum size of a set S such that for every in…
原文链接: https://leetcode-cn.com/problems/special-binary-string 英文原文Special binary strings are binary strings with the following two properties: The number of 0's is equal to the number of 1's. Every prefix of the binary string has at least as many 1's …
原文链接: https://leetcode-cn.com/problems/couples-holding-hands 英文原文There are n couples sitting in 2n seats arranged in a row and want to hold hands. The people and seats are represented by an integer array row where row[i] is the ID of the person sitti…
原文链接: https://leetcode-cn.com/problems/max-chunks-to-make-sorted-ii 英文原文You are given an integer array arr. We split arr into some number of chunks (i.e., partitions), and individually sort each chunk. After concatenating them, the result should equa…
原文链接: https://leetcode-cn.com/problems/basic-calculator-iv 英文原文Given an expression such as expression = "e + 8 - a + 5" and an evaluation map such as {"e": 1} (given in terms of evalvars = ["e"] and evalints = [1]), return a list of tokens representi…
原文链接: https://leetcode-cn.com/problems/sliding-puzzle 英文原文On an 2 x 3 board, there are five tiles labeled from 1 to 5, and an empty square represented by 0. A move consists of choosing 0 and a 4-directionally adjacent number and swapping it. The stat…
原文链接: https://leetcode-cn.com/problems/swim-in-rising-water 英文原文You are given an n x n integer matrix grid where each value grid[i][j] represents the elevation at that point (i, j). The rain starts to fall. At time t, the depth of the water everywher…
原文链接: https://leetcode-cn.com/problems/reaching-points 英文原文Given four integers sx, sy, tx, and ty, return true if it is possible to convert the point (sx, sy) to the point (tx, ty) through some operations, or false otherwise. The allowed operation on…
原文链接: https://leetcode-cn.com/problems/transform-to-chessboard 英文原文You are given an n x n binary grid board. In each move, you can swap any two rows with each other, or any two columns with each other. Return the minimum number of moves to transform …
原文链接: https://leetcode-cn.com/problems/k-th-smallest-prime-fraction 英文原文You are given a sorted integer array arr containing 1 and prime numbers, where all the integers of arr are unique. You are also given an integer k. For every i and j where 0 <= i…
原文链接: https://leetcode-cn.com/problems/preimage-size-of-factorial-zeroes-function 英文原文Let f(x) be the number of zeroes at the end of x!. Recall that x! = 1 * 2 * 3 * ... * x and by convention, 0! = 1. For example, f(3) = 0 because 3! = 6 has no zeroe…
原文链接: https://leetcode-cn.com/problems/smallest-rotation-with-highest-score 英文原文You are given an array nums. You can rotate it by a non-negative integer k so that the array becomes [nums[k], nums[k + 1], ... nums[nums.length - 1], nums[0], nums[1], .…
原文链接: https://leetcode-cn.com/problems/bricks-falling-when-hit 英文原文You are given an m x n binary grid, where each 1 represents a brick and 0 represents an empty space. A brick is stable if: It is directly connected to the top of the grid, or At least…
原文链接: https://leetcode-cn.com/problems/split-array-with-same-average 英文原文You are given an integer array nums. You should move each element of nums into one of the two arrays A and B such that A and B are non-empty, and average(A) == average(B). Retur…
原文链接: https://leetcode-cn.com/problems/chalkboard-xor-game 英文原文You are given an array of integers nums represents the numbers written on a chalkboard. Alice and Bob take turns erasing exactly one number from the chalkboard, with Alice starting first.…