原文链接: https://leetcode-cn.com/problems/count-special-quadruplets 英文原文Given a 0-indexed integer array nums, return the number of distinct quadruplets (a, b, c, d) such that: nums[a] + nums[b] + nums[c] == nums[d], and a < b < c < d Example 1: Input: n…
标签详情
数组 分类
原文链接: 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/convert-1d-array-into-2d-array 英文原文You are given a 0-indexed 1-dimensional (1D) integer array original, and two integers, m and n. You are tasked with creating a 2-dimensional (2D) array with m rows and n column…
原文链接: 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/maximum-number-of-ways-to-partition-an-array 英文原文You are given a 0-indexed integer array nums of length n. The number of ways to partition nums is the number of pivot indices that satisfy both conditions: 1 <= p…
原文链接: https://leetcode-cn.com/problems/final-value-of-variable-after-performing-operations 英文原文There is a programming language with only four operations and one variable X: ++X and X++ increments the value of the variable X by 1. --X and X-- decremen…
原文链接: 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/maximum-difference-between-increasing-elements 英文原文Given a 0-indexed integer array nums of size n, find the maximum difference between nums[i] and nums[j] (i.e., nums[j] - nums[i]), such that 0 <= i < j < n and …
原文链接: 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/minimum-number-of-moves-to-seat-everyone 英文原文There are n seats and n students in a room. You are given an array seats of length n, where seats[i] is the position of the ith seat. You are also given the array stu…
原文链接: https://leetcode-cn.com/problems/kth-smallest-product-of-two-sorted-arrays 英文原文Given two sorted 0-indexed integer arrays nums1 and nums2 as well as an integer k, return the kth (1-based) smallest product of nums1[i] * nums2[j] where 0 <= i < nu…
原文链接: 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/two-out-of-three 英文原文Given three integer arrays nums1, nums2, and nums3, return a distinct array containing all the values that are present in at least two out of the three arrays. You may return the values in a…
原文链接: 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/partition-array-into-two-arrays-to-minimize-sum-difference 英文原文You are given an integer array nums of 2 * n integers. You need to partition nums into two arrays of length n to minimize the absolute difference of…
原文链接: https://leetcode-cn.com/problems/kth-distinct-string-in-an-array 英文原文A distinct string is a string that is present only once in an array. Given an array of strings arr, and an integer k, return the kth distinct string present in arr. If there a…
原文链接: 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/number-of-valid-move-combinations-on-chessboard 英文原文There is an 8 x 8 chessboard containing n pieces (rooks, queens, or bishops). You are given a string array pieces of length n, where pieces[i] describes the ty…
原文链接: 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/second-minimum-time-to-reach-destination 英文原文A city is represented as a bi-directional connected graph with n vertices where each vertex is labeled from 1 to n (inclusive). The edges in the graph are represented…
原文链接: 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/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/smallest-index-with-equal-value 英文原文Given a 0-indexed integer array nums, return the smallest index i of nums such that i mod 10 == nums[i], or -1 if such index does not exist. x mod y denotes the remainder when…