原文链接: https://leetcode-cn.com/problems/find-a-peak-element-ii 英文原文A peak element in a 2D grid is an element that is strictly greater than all of its adjacent neighbors to the left, right, top, and bottom. Given a 0-indexed m x n matrix mat where no t…
标签详情
数组 分类
原文链接: https://leetcode-cn.com/problems/build-array-from-permutation 英文原文Given a zero-based permutation nums (0-indexed), build an array ans of the same length where ans[i] = nums[nums[i]] for each 0 <= i < nums.length and return it. A zero-based perm…
原文链接: https://leetcode-cn.com/problems/eliminate-maximum-number-of-monsters 英文原文You are playing a video game where you are defending your city from a group of n monsters. You are given a 0-indexed integer array dist of size n, where dist[i] is the in…
原文链接: https://leetcode-cn.com/problems/longest-common-subpath 英文原文There is a country of n cities numbered from 0 to n - 1. In this country, there is a road connecting every pair of cities. There are m friends numbered from 0 to m - 1 who are travelin…
原文链接: https://leetcode-cn.com/problems/the-number-of-the-smallest-unoccupied-chair 英文原文There is a party where n friends numbered from 0 to n - 1 are attending. There is an infinite number of chairs in this party that are numbered from 0 to infinity. …
原文链接: https://leetcode-cn.com/problems/describe-the-painting 英文原文There is a long and thin painting that can be represented by a number line. The painting was painted with multiple overlapping segments where each segment was painted with a unique colo…
原文链接: https://leetcode-cn.com/problems/largest-number-after-mutating-substring 英文原文You are given a string num, which represents a large integer. You are also given a 0-indexed integer array change of length 10 that maps each digit 0-9 to another digi…
原文链接: https://leetcode-cn.com/problems/maximum-compatibility-score-sum 英文原文There is a survey that consists of n questions where each question's answer is either 0 (no) or 1 (yes). The survey was given to m students numbered from 0 to m - 1 and m ment…
原文链接: https://leetcode-cn.com/problems/delete-duplicate-folders-in-system 英文原文Due to a bug, there are many duplicate folders in a file system. You are given a 2D array paths, where paths[i] is an array representing an absolute path to the ith folder …
原文链接: https://leetcode-cn.com/problems/check-if-move-is-legal 英文原文You are given a 0-indexed 8 x 8 grid board, where board[r][c] represents the cell (r, c) on a game board. On the board, free cells are represented by '.', white cells are represented b…
原文链接: https://leetcode-cn.com/problems/maximum-number-of-weeks-for-which-you-can-work 英文原文There are n projects numbered from 0 to n - 1. You are given an integer array milestones where each milestones[i] denotes the number of milestones the ith proje…
原文链接: https://leetcode-cn.com/problems/count-number-of-special-subsequences 英文原文A sequence is special if it consists of a positive number of 0s, followed by a positive number of 1s, then a positive number of 2s. For example, [0,1,2] and [0,0,1,1,1,2]…
原文链接: https://leetcode-cn.com/problems/array-with-elements-not-equal-to-average-of-neighbors 英文原文You are given a 0-indexed array nums of distinct integers. You want to rearrange the elements in the array such that every element in the rearranged arra…
原文链接: https://leetcode-cn.com/problems/maximum-matrix-sum 英文原文You are given an n x n integer matrix. You can do the following operation any number of times: Choose any two adjacent elements of matrix and multiply each of them by -1. Two elements are …
原文链接: https://leetcode-cn.com/problems/check-if-string-is-a-prefix-of-array 英文原文Given a string s and an array of strings words, determine whether s is a prefix string of words. A string s is a prefix string of words if s can be made by concatenating …
原文链接: https://leetcode-cn.com/problems/remove-stones-to-minimize-the-total 英文原文You are given a 0-indexed integer array piles, where piles[i] represents the number of stones in the ith pile, and an integer k. You should apply the following operation e…
原文链接: https://leetcode-cn.com/problems/find-the-longest-valid-obstacle-course-at-each-position 英文原文You want to build some obstacle courses. You are given a 0-indexed integer array obstacles of length n, where obstacles[i] describes the height of the …
原文链接: https://leetcode-cn.com/problems/last-day-where-you-can-still-cross 英文原文There is a 1-based binary matrix where 0 represents land and 1 represents water. You are given integers row and col representing the number of rows and columns in the matri…
原文链接: https://leetcode-cn.com/problems/find-the-middle-index-in-array 英文原文Given a 0-indexed integer array nums, find the leftmost middleIndex (i.e., the smallest amongst all the possible ones). A middleIndex is an index where nums[0] + nums[1] + ... …
原文链接: https://leetcode-cn.com/problems/the-number-of-good-subsets 英文原文You are given an integer array nums. We call a subset of nums good if its product can be represented as a product of one or more distinct prime numbers. For example, if nums = [1, …
原文链接: https://leetcode-cn.com/problems/find-greatest-common-divisor-of-array 英文原文Given an integer array nums, return the greatest common divisor of the smallest number and largest number in nums. The greatest common divisor of two numbers is the larg…
原文链接: https://leetcode-cn.com/problems/find-unique-binary-string 英文原文Given an array of strings nums containing n unique binary strings each of length n, return a binary string of length n that does not appear in nums. If there are multiple answers, y…
原文链接: https://leetcode-cn.com/problems/find-array-given-subset-sums 英文原文You are given an integer n representing the length of an unknown array that you are trying to recover. You are also given an array sums containing the values of all 2n subset sum…
原文链接: https://leetcode-cn.com/problems/minimize-the-difference-between-target-and-chosen-elements 英文原文You are given an m x n integer matrix mat and an integer target. Choose one integer from each row in the matrix such that the absolute difference be…
原文链接: https://leetcode-cn.com/problems/minimum-difference-between-highest-and-lowest-of-k-scores 英文原文You are given a 0-indexed integer array nums, where nums[i] represents the score of the ith student. You are also given an integer k. Pick the scores…
原文链接: https://leetcode-cn.com/problems/find-the-kth-largest-integer-in-the-array 英文原文You are given an array of strings nums and an integer k. Each string in nums represents an integer without leading zeros. Return the string that represents the kth l…
原文链接: https://leetcode-cn.com/problems/count-number-of-pairs-with-absolute-difference-k 英文原文Given an integer array nums and an integer k, return the number of pairs (i, j) where i < j such that |nums[i] - nums[j]| == k. The value of |x| is defined as…
原文链接: https://leetcode-cn.com/problems/find-original-array-from-doubled-array 英文原文An integer array original is transformed into a doubled array changed by appending twice the value of every element in original, and then randomly shuffling the resulti…
原文链接: https://leetcode-cn.com/problems/maximum-earnings-from-taxi 英文原文There are n points on a road you are driving your taxi on. The n points on the road are labeled from 1 to n in the direction you are going, and you want to drive from point 1 to po…
原文链接: https://leetcode-cn.com/problems/minimum-number-of-operations-to-make-array-continuous 英文原文You are given an integer array nums. In one operation, you can replace any element in nums with any integer. nums is considered continuous if both of the…