原文链接: https://leetcode-cn.com/problems/the-number-of-weak-characters-in-the-game 英文原文You are playing a game that contains multiple characters, and each of the characters has two main properties: attack and defense. You are given a 2D integer array pr…
分类详情
中等 分类
原文链接: https://leetcode-cn.com/problems/first-day-where-you-have-been-in-all-the-rooms 英文原文There are n rooms you need to visit, labeled from 0 to n - 1. Each day is labeled, starting from 0. You will go in and visit one room a day. Initially on day 0,…
原文链接: https://leetcode-cn.com/problems/number-of-pairs-of-interchangeable-rectangles 英文原文You are given n rectangles represented by a 0-indexed 2D integer array rectangles, where rectangles[i] = [widthi, heighti] denotes the width and height of the it…
原文链接: https://leetcode-cn.com/problems/maximum-product-of-the-length-of-two-palindromic-subsequences 英文原文Given a string s, find two disjoint palindromic subsequences of s such that the product of their lengths is maximized. The two subsequences are d…
原文链接: https://leetcode-cn.com/problems/number-of-pairs-of-strings-with-concatenation-equal-to-target 英文原文Given an array of digit strings nums and a digit string target, return the number of pairs of indices (i, j) (where i != j) such that the concate…
原文链接: https://leetcode-cn.com/problems/maximize-the-confusion-of-an-exam 英文原文A teacher is writing a test with n true/false questions, with 'T' denoting true and 'F' denoting false. He wants to confuse the students by maximizing the number of consecut…
原文链接: https://leetcode-cn.com/problems/sum-of-beauty-in-the-array 英文原文You are given a 0-indexed integer array nums. For each index i (1 <= i <= nums.length - 2) the beauty of nums[i] equals: 2, if nums[j] < nums[i] < nums[k], for all 0 <= j < i and f…
原文链接: https://leetcode-cn.com/problems/detect-squares 英文原文You are given a stream of points on the X-Y plane. Design an algorithm that: Adds new points from the stream into a data structure. Duplicate points are allowed and should be treated as differ…
原文链接: https://leetcode-cn.com/problems/grid-game 英文原文You are given a 0-indexed 2D array grid of size 2 x n, where grid[r][c] represents the number of points at position (r, c) on the matrix. Two robots are playing a game on this matrix. Both robots i…
原文链接: https://leetcode-cn.com/problems/check-if-word-can-be-placed-in-crossword 英文原文You are given an m x n matrix board, representing the current state of a crossword puzzle. The crossword contains lowercase English letters (from solved words), ' ' t…
原文链接: https://leetcode-cn.com/problems/remove-colored-pieces-if-both-neighbors-are-the-same-color 英文原文There are n pieces arranged in a line, and each piece is colored either by 'A' or by 'B'. You are given a string colors of length n where colors[i] …
原文链接: https://leetcode-cn.com/problems/the-time-when-the-network-becomes-idle 英文原文There is a network of n servers, labeled from 0 to n - 1. You are given a 2D integer array edges, where edges[i] = [ui, vi] indicates there is a message channel between…
原文链接: https://leetcode-cn.com/problems/find-missing-observations 英文原文You have observations of n + m 6-sided dice rolls with each face numbered from 1 to 6. n of the observations went missing, and you only have the observations of m rolls. Fortunately…
原文链接: https://leetcode-cn.com/problems/stone-game-ix 英文原文Alice and Bob continue their games with stones. There is a row of n stones, and each stone has an associated value. You are given an integer array stones, where stones[i] is the value of the it…
原文链接: https://leetcode-cn.com/problems/minimum-operations-to-make-a-uni-value-grid 英文原文You are given a 2D integer grid of size m x n and an integer x. In one operation, you can add x to or subtract x from any element in the grid. A uni-value grid is …
原文链接: https://leetcode-cn.com/problems/stock-price-fluctuation 英文原文You are given a stream of records about a particular stock. Each record contains a timestamp and the corresponding price of the stock at that timestamp. Unfortunately due to the volat…
原文链接: https://leetcode-cn.com/problems/two-best-non-overlapping-events 英文原文You are given a 0-indexed 2D integer array of events where events[i] = [startTimei, endTimei, valuei]. The ith event starts at startTimei and ends at endTimei, and if you atte…
原文链接: https://leetcode-cn.com/problems/plates-between-candles 英文原文There is a long table with a line of plates and candles arranged on top of it. You are given a 0-indexed string s consisting of characters '*' and '|' only, where a '*' represents a pl…
原文链接: https://leetcode-cn.com/problems/count-number-of-maximum-bitwise-or-subsets 英文原文Given an integer array nums, find the maximum possible bitwise OR of a subset of nums and return the number of different non-empty subsets with the maximum bitwise …
原文链接: https://leetcode-cn.com/problems/next-greater-numerically-balanced-number 英文原文An integer x is numerically balanced if for every digit d in the number x, there are exactly d occurrences of that digit in x. Given an integer n, return the smallest…
原文链接: https://leetcode-cn.com/problems/count-nodes-with-the-highest-score 英文原文There is a binary tree rooted at 0 consisting of n nodes. The nodes are labeled from 0 to n - 1. You are given a 0-indexed integer array parents representing the tree, wher…
原文链接: https://leetcode-cn.com/problems/walking-robot-simulation-ii 英文原文A width x height grid is on an XY-plane with the bottom-left cell at (0, 0) and the top-right cell at (width - 1, height - 1). The grid is aligned with the four cardinal direction…
原文链接: https://leetcode-cn.com/problems/most-beautiful-item-for-each-query 英文原文You are given a 2D integer array items where items[i] = [pricei, beautyi] denotes the price and beauty of an item respectively. You are also given a 0-indexed integer array…
原文链接: https://leetcode-cn.com/problems/find-the-minimum-and-maximum-number-of-nodes-between-critical-points 英文原文A critical point in a linked list is defined as either a local maxima or a local minima. A node is a local maxima if the current node has …
原文链接: https://leetcode-cn.com/problems/minimum-operations-to-convert-number 英文原文You are given a 0-indexed integer array nums containing distinct numbers, an integer start, and an integer goal. There is an integer x that is initially set to start, and…
原文链接: https://leetcode-cn.com/problems/vowels-of-all-substrings 英文原文Given a string word, return the sum of the number of vowels ('a', 'e', 'i', 'o', and 'u') in every substring of word. A substring is a contiguous (non-empty) sequence of characters w…
原文链接: https://leetcode-cn.com/problems/minimized-maximum-of-products-distributed-to-any-store 英文原文You are given an integer n indicating there are n specialty retail stores. There are m product types of varying amounts, which are given as a 0-indexed …
原文链接: https://leetcode-cn.com/problems/minimum-cost-homecoming-of-a-robot-in-a-grid 英文原文There is an m x n grid, where (0, 0) is the top-left cell and (m - 1, n - 1) is the bottom-right cell. You are given an integer array startPos where startPos = [s…
原文链接: https://leetcode-cn.com/problems/reverse-nodes-in-even-length-groups 英文原文You are given the head of a linked list. The nodes in the linked list are sequentially assigned to non-empty groups whose lengths form the sequence of the natural numbers …
原文链接: https://leetcode-cn.com/problems/decode-the-slanted-ciphertext 英文原文A string originalText is encoded using a slanted transposition cipher to a string encodedText with the help of a matrix having a fixed number of rows rows. originalText is place…