原文链接: https://leetcode-cn.com/problems/flip-columns-for-maximum-number-of-equal-rows 英文原文You are given an m x n binary matrix matrix. You can choose any number of columns in the matrix and flip every cell in that column (i.e., Change the value of the…
标签详情
数组 分类
原文链接: https://leetcode-cn.com/problems/duplicate-zeros 英文原文Given a fixed-length integer array arr, duplicate each occurrence of zero, shifting the remaining elements to the right. Note that elements beyond the length of the original array are not wri…
原文链接: https://leetcode-cn.com/problems/largest-values-from-labels 英文原文There is a set of n items. You are given two integer arrays values and labels where the value and the label of the ith element are values[i] and labels[i] respectively. You are als…
原文链接: https://leetcode-cn.com/problems/car-pooling 英文原文There is a car with capacity empty seats. The vehicle only drives east (i.e., it cannot turn around and drive west). You are given the integer capacity and an array trips where trip[i] = [numPass…
原文链接: https://leetcode-cn.com/problems/find-in-mountain-array 英文原文(This problem is an interactive problem.) You may recall that an array arr is a mountain array if and only if: arr.length >= 3 There exists some i with 0 < i < arr.length - 1 such that…
原文链接: https://leetcode-cn.com/problems/filling-bookcase-shelves 英文原文You are given an array books where books[i] = [thicknessi, heighti] indicates the thickness and height of the ith book. You are also given an integer shelfWidth. We want to place the…
原文链接: https://leetcode-cn.com/problems/corporate-flight-bookings 英文原文There are n flights that are labeled from 1 to n. You are given an array of flight bookings bookings, where bookings[i] = [firsti, lasti, seatsi] represents a booking for flights fi…
原文链接: https://leetcode-cn.com/problems/mean-of-array-after-removing-some-elements 英文原文Given an integer array arr, return the mean of the remaining integers after removing the smallest 5% and the largest 5% of the elements. Answers within 10-5 of the …
原文链接: https://leetcode-cn.com/problems/relative-sort-array 英文原文Given two arrays arr1 and arr2, the elements of arr2 are distinct, and all elements in arr2 are also in arr1. Sort the elements of arr1 such that the relative ordering of items in arr1 ar…
原文链接: https://leetcode-cn.com/problems/longest-well-performing-interval 英文原文We are given hours, a list of the number of hours worked per day for a given employee. A day is considered to be a tiring day if and only if the number of hours worked is (st…
原文链接: https://leetcode-cn.com/problems/smallest-sufficient-team 英文原文In a project, you have a list of required skills req_skills, and a list of people. The ith person people[i] contains a list of skills that the person has. Consider a sufficient team:…
原文链接: https://leetcode-cn.com/problems/element-appearing-more-than-25-in-sorted-array 英文原文Given an integer array sorted in non-decreasing order, there is exactly one integer in the array that occurs more than 25% of the time, return that integer. Exa…
原文链接: https://leetcode-cn.com/problems/remove-covered-intervals 英文原文Given an array intervals where intervals[i] = [li, ri] represent the interval [li, ri), remove all intervals that are covered by another interval in the list. The interval [a, b) is …
原文链接: https://leetcode-cn.com/problems/graph-connectivity-with-threshold 英文原文We have n cities labeled from 1 to n. Two different cities with labels x and y are directly connected by a bidirectional road if and only if x and y share a common divisor s…
原文链接: https://leetcode-cn.com/problems/minimum-falling-path-sum-ii 英文原文Given an n x n integer matrix grid, return the minimum sum of a falling path with non-zero shifts. A falling path with non-zero shifts is a choice of exactly one element from each…
原文链接: https://leetcode-cn.com/problems/number-of-equivalent-domino-pairs 英文原文Given a list of dominoes, dominoes[i] = [a, b] is equivalent to dominoes[j] = [c, d] if and only if either (a == c and b == d), or (a == d and b == c) - that is, one domino …
原文链接: https://leetcode-cn.com/problems/maximum-of-absolute-value-expression 英文原文Given two arrays of integers with equal lengths, return the maximum value of: |arr1[i] - arr1[j]| + |arr2[i] - arr2[j]| + |i - j| where the maximum is taken over all 0 <=…
原文链接: https://leetcode-cn.com/problems/replace-elements-with-greatest-element-on-right-side 英文原文Given an array arr, replace every element in that array with the greatest element among the elements to its right, and replace the last element with -1. A…
原文链接: https://leetcode-cn.com/problems/sum-of-mutated-array-closest-to-target 英文原文Given an integer array arr and a target value target, return the integer value such that when we change all the integers larger than value in the given array to be equa…
原文链接: https://leetcode-cn.com/problems/number-of-paths-with-max-score 英文原文You are given a square board of characters. You can move on the board starting at the bottom right square marked with the character 'S'. You need to reach the top left square m…
原文链接: https://leetcode-cn.com/problems/largest-1-bordered-square 英文原文Given a 2D grid of 0s and 1s, return the number of elements in the largest square subgrid that has all 1s on its border, or 0 if such a subgrid doesn't exist in the grid. Example 1:…
原文链接: https://leetcode-cn.com/problems/stone-game-ii 英文原文Alice and Bob continue their games with piles of stones. There are a number of piles arranged in a row, and each pile has a positive integer number of stones piles[i]. The objective of the game…
原文链接: https://leetcode-cn.com/problems/decompress-run-length-encoded-list 英文原文We are given a list nums of integers representing a list compressed with run-length encoding. Consider each adjacent pair of elements [freq, val] = [nums[2*i], nums[2*i+1]]…
原文链接: https://leetcode-cn.com/problems/matrix-block-sum 英文原文Given a m x n matrix mat and an integer k, return a matrix answer where each answer[i][j] is the sum of all elements mat[r][c] for: i - k <= r <= i + k, j - k <= c <= j + k, and (r, c) is a …
原文链接: https://leetcode-cn.com/problems/decrease-elements-to-make-array-zigzag 英文原文Given an array nums of integers, a move consists of choosing any element and decreasing it by 1. An array A is a zigzag array if either: Every even-indexed element is g…
原文链接: https://leetcode-cn.com/problems/sort-the-matrix-diagonally 英文原文A matrix diagonal is a diagonal line of cells starting from some cell in either the topmost row or leftmost column and going in the bottom-right direction until reaching the matrix…
原文链接: https://leetcode-cn.com/problems/reverse-subarray-to-maximize-array-value 英文原文You are given an integer array nums. The value of this array is defined as the sum of |nums[i] - nums[i + 1]| for all 0 <= i < nums.length - 1. You are allowed to sel…
原文链接: https://leetcode-cn.com/problems/rank-transform-of-an-array 英文原文Given an array of integers arr, replace each element with its rank. The rank represents how large the element is. The rank has the following rules: Rank is an integer starting from…
原文链接: https://leetcode-cn.com/problems/rank-transform-of-a-matrix 英文原文Given an m x n matrix, return a new matrix answer where answer[row][col] is the rank of matrix[row][col]. The rank is an integer that represents how large an element is compared to…
原文链接: https://leetcode-cn.com/problems/snapshot-array 英文原文Implement a SnapshotArray that supports the following interface: SnapshotArray(int length) initializes an array-like data structure with the given length. Initially, each element equals 0. voi…