原文链接: https://leetcode-cn.com/problems/get-maximum-in-generated-array 英文原文You are given an integer n. A 0-indexed integer array nums of length n + 1 is generated in the following way: nums[0] = 0 nums[1] = 1 nums[2 * i] = nums[i] when 2 <= 2 * i <= n…
标签详情
数组 分类
原文链接: https://leetcode-cn.com/problems/sell-diminishing-valued-colored-balls 英文原文You have an inventory of different colored balls, and there is a customer that wants orders balls of any color. The customer weirdly values the colored balls. Each color…
原文链接: https://leetcode-cn.com/problems/design-an-ordered-stream 英文原文There is a stream of n (idKey, value) pairs arriving in an arbitrary order, where idKey is an integer between 1 and n and value is a string. No two pairs have the same id. Design a s…
原文链接: https://leetcode-cn.com/problems/minimum-operations-to-reduce-x-to-zero 英文原文You are given an integer array nums and an integer x. In one operation, you can either remove the leftmost or the rightmost element from the array nums and subtract its…
原文链接: https://leetcode-cn.com/problems/check-if-two-string-arrays-are-equivalent 英文原文Given two string arrays word1 and word2, return true if the two arrays represent the same string, and false otherwise. A string is represented by an array if the arr…
原文链接: https://leetcode-cn.com/problems/minimum-interval-to-include-each-query 英文原文You are given a 2D integer array intervals, where intervals[i] = [lefti, righti] describes the ith interval starting at lefti and ending at righti (inclusive). The size…
原文链接: https://leetcode-cn.com/problems/maximum-population-year 英文原文You are given a 2D integer array logs where each logs[i] = [birthi, deathi] indicates the birth and death years of the ith person. The population of some year x is the number of peopl…
原文链接: https://leetcode-cn.com/problems/maximum-distance-between-a-pair-of-values 英文原文You are given two non-increasing 0-indexed integer arrays nums1 and nums2. A pair of indices (i, j), where 0 <= i < nums1.length and 0 <= j < nums2.lengt…
原文链接: https://leetcode-cn.com/problems/maximum-subarray-min-product 英文原文The min-product of an array is equal to the minimum value in the array multiplied by the array's sum. For example, the array [3,2,5] (minimum value is 2) has a min-product of 2 *…
原文链接: https://leetcode-cn.com/problems/minimize-maximum-pair-sum-in-array 英文原文The pair sum of a pair (a,b) is equal to a + b. The maximum pair sum is the largest pair sum in a list of pairs. For example, if we have pairs (1,5), (2,3), and (4,4), the …
原文链接: https://leetcode-cn.com/problems/minimum-xor-sum-of-two-arrays 英文原文You are given two integer arrays nums1 and nums2 of length n. The XOR sum of the two integer arrays is (nums1[0] XOR nums2[0]) + (nums1[1] XOR nums2[1]) + ... + (nums1[n - 1] XO…
原文链接: https://leetcode-cn.com/problems/sum-of-all-subset-xor-totals 英文原文The XOR total of an array is defined as the bitwise XOR of all its elements, or 0 if the array is empty. For example, the XOR total of the array [2,5,6] is 2 XOR 5 XOR 6 = 1. Giv…
原文链接: https://leetcode-cn.com/problems/finding-pairs-with-a-certain-sum 英文原文You are given two integer arrays nums1 and nums2. You are tasked to implement a data structure that supports queries of two types: Add a positive integer to an element of a g…
原文链接: https://leetcode-cn.com/problems/minimum-speed-to-arrive-on-time 英文原文You are given a floating-point number hour, representing the amount of time you have to reach the office. To commute to the office, you must take n trains in sequential order.…
原文链接: https://leetcode-cn.com/problems/stone-game-viii 英文原文Alice and Bob take turns playing a game, with Alice starting first. There are n stones arranged in a row. On each player's turn, while the number of stones is more than one, they will do the …
原文链接: https://leetcode-cn.com/problems/check-if-all-the-integers-in-a-range-are-covered 英文原文You are given a 2D integer array ranges and two integers left and right. Each ranges[i] = [starti, endi] represents an inclusive interval between starti and e…
原文链接: https://leetcode-cn.com/problems/find-the-student-that-will-replace-the-chalk 英文原文There are n students in a class numbered from 0 to n - 1. The teacher will give each student a problem starting with the student number 0, then the student number…
原文链接: https://leetcode-cn.com/problems/process-tasks-using-servers 英文原文You are given two 0-indexed integer arrays servers and tasks of lengths n and m respectively. servers[i] is the weight of the ith server, and tasks[j] is the…
原文链接: https://leetcode-cn.com/problems/determine-whether-matrix-can-be-obtained-by-rotation 英文原文Given two n x n binary matrices mat and target, return true if it is possible to make mat equal to target by rotating mat in 90-degree increments, or fals…
原文链接: https://leetcode-cn.com/problems/reduction-operations-to-make-the-array-elements-equal 英文原文Given an integer array nums, your goal is to make all elements in nums equal. To complete one operation, follow these steps: Find the largest value in nu…
原文链接: https://leetcode-cn.com/problems/minimum-space-wasted-from-packaging 英文原文You have n packages that you are trying to place in boxes, one package in each box. There are m suppliers that each produce boxes of different sizes (with infinite supply)…
原文链接: https://leetcode-cn.com/problems/remove-one-element-to-make-the-array-strictly-increasing 英文原文Given a 0-indexed integer array nums, return true if it can be made strictly increasing after removing exactly one element, or false otherwise. If the…
原文链接: https://leetcode-cn.com/problems/maximum-alternating-subsequence-sum 英文原文The alternating sum of a 0-indexed array is defined as the sum of the elements at even indices minus the sum of the elements at odd indices. For example, the alternating s…
原文链接: https://leetcode-cn.com/problems/design-movie-rental-system 英文原文You have a movie renting company consisting of n shops. You want to implement a renting system that supports searching for, booking, and returning movies. The system should also su…
原文链接: https://leetcode-cn.com/problems/merge-triplets-to-form-target-triplet 英文原文A triplet is an array of three integers. You are given a 2D integer array triplets, where triplets[i] = [ai, bi, ci] describes the ith triplet. You are also given an int…
原文链接: https://leetcode-cn.com/problems/maximum-number-of-removable-characters 英文原文You are given two strings s and p where p is a subsequence of s. You are also given a distinct 0-indexed integer array removable containing a subset of indices of s (s …
原文链接: https://leetcode-cn.com/problems/minimum-absolute-difference-queries 英文原文The minimum absolute difference of an array a is defined as the minimum value of |a[i] - a[j]|, where 0 <= i < j < a.length and a[i] != a[j]. If all elements of a are the …
原文链接: https://leetcode-cn.com/problems/nearest-exit-from-entrance-in-maze 英文原文You are given an m x n matrix maze (0-indexed) with empty cells (represented as '.') and walls (represented as '+'). You are also given the entrance of the maze, where entr…
原文链接: https://leetcode-cn.com/problems/maximum-product-difference-between-two-pairs 英文原文The product difference between two pairs (a, b) and (c, d) is defined as (a * b) - (c * d). For example, the product difference between (5, 6) and (2, 7) is (5 * …
原文链接: https://leetcode-cn.com/problems/cyclically-rotating-a-grid 英文原文You are given an m x n integer matrix grid, where m and n are both even integers, and an integer k. The matrix is composed of several layers, which is shown in the below image, …