原文链接: https://leetcode-cn.com/problems/falling-squares 英文原文There are several squares being dropped onto the X-axis of a 2D plane. You are given a 2D integer array positions where positions[i] = [lefti, sideLengthi] represents the ith square with a si…
标签详情
数组 分类
原文链接: https://leetcode-cn.com/problems/subarray-product-less-than-k 英文原文Given an array of integers nums and an integer k, return the number of contiguous subarrays where the product of all the elements in the subarray is strictly less than k. Example…
原文链接: https://leetcode-cn.com/problems/best-time-to-buy-and-sell-stock-with-transaction-fee 英文原文You are given an array prices where prices[i] is the price of a given stock on the ith day, and an integer fee representing a transaction fee. Find the ma…
原文链接: https://leetcode-cn.com/problems/1-bit-and-2-bit-characters 英文原文We have two special characters: The first character can be represented by one bit 0. The second character can be represented by two bits (10 or 11). Given a binary array bits that …
原文链接: https://leetcode-cn.com/problems/maximum-length-of-repeated-subarray 英文原文Given two integer arrays nums1 and nums2, return the maximum length of a subarray that appears in both arrays. Example 1: Input: nums1 = [1,2,3,2,1], nums2 = [3,2,1,4,7] O…
原文链接: https://leetcode-cn.com/problems/find-k-th-smallest-pair-distance 英文原文The distance of a pair of integers a and b is defined as the absolute difference between a and b. Given an integer array nums and an integer k, return the kth smallest distan…
原文链接: https://leetcode-cn.com/problems/longest-word-in-dictionary 英文原文Given an array of strings words representing an English Dictionary, return the longest word in words that can be built one character at a time by other words in words. If there is …
原文链接: https://leetcode-cn.com/problems/accounts-merge 英文原文Given a list of accounts where each element accounts[i] is a list of strings, where the first element accounts[i][0] is a name, and the rest of the elements are emails representing emails of t…
原文链接: https://leetcode-cn.com/problems/remove-comments 英文原文Given a C++ program, remove comments from it. The program source is an array of strings source where source[i] is the ith line of the source code. This represents the result of splitting the …
原文链接: https://leetcode-cn.com/problems/find-pivot-index 英文原文Given an array of integers nums, calculate the pivot index of this array. The pivot index is the index where the sum of all the numbers strictly to the left of the index is equal to the sum …
原文链接: https://leetcode-cn.com/problems/flood-fill 英文原文An image is represented by an m x n integer grid image where image[i][j] represents the pixel value of the image. You are also given three integers sr, sc, and newColor. You should perform a flood…
原文链接: https://leetcode-cn.com/problems/asteroid-collision 英文原文We are given an array asteroids of integers representing asteroids in a row. For each asteroid, the absolute value represents its size, and the sign represents its direction (positive mean…
原文链接: https://leetcode-cn.com/problems/daily-temperatures 英文原文Given an array of integers temperatures represents the daily temperatures, return an array answer such that answer[i] is the number of days you have to wait after the ith day to get a warm…
原文链接: https://leetcode-cn.com/problems/cherry-pickup 英文原文You are given an n x n grid representing a field of cherries, each cell is one of three possible integers. 0 means the cell is empty, so you can pass through, 1 means the cell contains a cherry…
原文链接: https://leetcode-cn.com/problems/delete-and-earn 英文原文You are given an integer array nums. You want to maximize the number of points you get by performing the following operation any number of times: Pick any nums[i] and delete it to earn nums[i…
原文链接: https://leetcode-cn.com/problems/find-smallest-letter-greater-than-target 英文原文Given a characters array letters that is sorted in non-decreasing order and a character target, return the smallest character in the array that is larger than target.…
原文链接: https://leetcode-cn.com/problems/largest-number-at-least-twice-of-others 英文原文You are given an integer array nums where the largest integer is unique. Determine whether the largest element in the array is at least twice as much as every other nu…
原文链接: https://leetcode-cn.com/problems/min-cost-climbing-stairs 英文原文You are given an integer array cost where cost[i] is the cost of ith step on a staircase. Once you pay the cost, you can either climb one or two steps. You can either start from the …
原文链接: https://leetcode-cn.com/problems/contain-virus 英文原文A virus is spreading rapidly, and your task is to quarantine the infected area by installing walls. The world is modeled as an m x n binary grid isInfected, where isInfected[i][j] == 0 represen…
原文链接: https://leetcode-cn.com/problems/set-intersection-size-at-least-two 英文原文An integer interval [a, b] (for integers a < b) is a set of all consecutive integers from a to b, including a and b. Find the minimum size of a set S such that for every in…
原文链接: https://leetcode-cn.com/problems/largest-plus-sign 英文原文You are given an integer n. You have an n x n binary grid grid with all values initially 1's except for some indices given in the array mines. The ith element of the array mines is defined …
原文链接: https://leetcode-cn.com/problems/construct-quad-tree 英文原文Given a n * n matrix grid of 0's and 1's only. We want to represent the grid with a Quad-Tree. Return the root of the Quad-Tree representing the grid. Notice that you can assign the value…
原文链接: https://leetcode-cn.com/problems/toeplitz-matrix 英文原文Given an m x n matrix, return true if the matrix is Toeplitz. Otherwise, return false. A matrix is Toeplitz if every diagonal from top-left to bottom-right has the same elements. Example 1: I…
原文链接: https://leetcode-cn.com/problems/max-chunks-to-make-sorted-ii 英文原文You are given an integer array arr. We split arr into some number of chunks (i.e., partitions), and individually sort each chunk. After concatenating them, the result should equa…
原文链接: https://leetcode-cn.com/problems/max-chunks-to-make-sorted 英文原文You are given an integer array arr of length n that represents a permutation of the integers in the range [0, n - 1]. We split arr into some number of chunks (i.e., partitions), and…
原文链接: https://leetcode-cn.com/problems/sliding-puzzle 英文原文On an 2 x 3 board, there are five tiles labeled from 1 to 5, and an empty square represented by 0. A move consists of choosing 0 and a 4-directionally adjacent number and swapping it. The stat…
原文链接: https://leetcode-cn.com/problems/global-and-local-inversions 英文原文You are given an integer array nums of length n which represents a permutation of all the integers in the range [0, n - 1]. The number of global inversions is the number of the di…
原文链接: https://leetcode-cn.com/problems/binary-search 英文原文Given an array of integers nums which is sorted in ascending order, and an integer target, write a function to search target in nums. If target exists, then return its index. Otherwise, return …
原文链接: https://leetcode-cn.com/problems/swim-in-rising-water 英文原文You are given an n x n integer matrix grid where each value grid[i][j] represents the elevation at that point (i, j). The rain starts to fall. At time t, the depth of the water everywher…
原文链接: https://leetcode-cn.com/problems/transform-to-chessboard 英文原文You are given an n x n binary grid board. In each move, you can swap any two rows with each other, or any two columns with each other. Return the minimum number of moves to transform …