原文链接: https://leetcode-cn.com/problems/sum-of-all-odd-length-subarrays 英文原文Given an array of positive integers arr, calculate the sum of all possible odd-length subarrays. A subarray is a contiguous subsequence of the array. Return the sum of all odd…
标签详情
数组 分类
原文链接: https://leetcode-cn.com/problems/maximum-sum-obtained-of-any-permutation 英文原文We have an array of integers, nums, and an array of requests where requests[i] = [starti, endi]. The ith request asks for the sum of nums[starti] + nums[starti + 1] + …
原文链接: https://leetcode-cn.com/problems/strange-printer-ii 英文原文There is a strange printer with the following two special requirements: On each turn, the printer will print a solid rectangular pattern of a single color on the grid. This will cover up t…
原文链接: https://leetcode-cn.com/problems/number-of-ways-where-square-of-number-is-equal-to-product-of-two-numbers 英文原文Given two arrays of integers nums1 and nums2, return the number of triplets formed (type 1 and type 2) under the following rules: Type…
原文链接: https://leetcode-cn.com/problems/minimum-deletion-cost-to-avoid-repeating-letters 英文原文Given a string s and an array of integers cost where cost[i] is the cost of deleting the ith character in s. Return the minimum cost of deletions such that th…
原文链接: https://leetcode-cn.com/problems/special-positions-in-a-binary-matrix 英文原文Given a rows x cols matrix mat, where mat[i][j] is either 0 or 1, return the number of special positions in mat. A position (i,j) is called special if mat[i][j] == 1 and …
原文链接: https://leetcode-cn.com/problems/min-cost-to-connect-all-points 英文原文You are given an array points representing integer coordinates of some points on a 2D-plane, where points[i] = [xi, yi]. The cost of connecting two points [xi, yi] and [xj, yj]…
原文链接: https://leetcode-cn.com/problems/alert-using-same-key-card-three-or-more-times-in-a-one-hour-period 英文原文LeetCode company workers use key-cards to unlock office doors. Each time a worker uses their key-card, the security system saves the worker'…
原文链接: https://leetcode-cn.com/problems/find-servers-that-handled-most-number-of-requests 英文原文You have k servers numbered from 0 to k-1 that are being used to handle multiple requests simultaneously. Each server has infinite computational capacity but…
原文链接: https://leetcode-cn.com/problems/find-valid-matrix-given-row-and-column-sums 英文原文You are given two arrays rowSum and colSum of non-negative integers where rowSum[i] is the sum of the elements in the ith row and colSum[j] is the sum of the eleme…
原文链接: https://leetcode-cn.com/problems/minimum-cost-to-connect-two-groups-of-points 英文原文You are given two groups of points where the first group has size1 points, the second group has size2 points, and size1 >= size2. The cost of the connection betwe…
原文链接: https://leetcode-cn.com/problems/crawler-log-folder 英文原文The Leetcode file system keeps a log each time some user performs a change folder operation. The operations are described below: "../" : Move to the parent folder of the current folder. (I…
原文链接: https://leetcode-cn.com/problems/maximum-profit-of-operating-a-centennial-wheel 英文原文You are the operator of a Centennial Wheel that has four gondolas, and each gondola has room for up to four people. You have the ability to rotate the gondolas …
原文链接: https://leetcode-cn.com/problems/coordinate-with-maximum-network-quality 英文原文You are given an array of network towers towers, where towers[i] = [xi, yi, qi] denotes the ith network tower with location (xi, yi) and quality factor qi. All the coo…
原文链接: https://leetcode-cn.com/problems/special-array-with-x-elements-greater-than-or-equal-x 英文原文You are given an array nums of non-negative integers. nums is considered special if there exists a number x such that there are exactly x numbers in nums…
原文链接: https://leetcode-cn.com/problems/maximum-number-of-visible-points 英文原文You are given an array points, an integer angle, and your location, where location = [posx, posy] and points[i] = [xi, yi] both denote integral coordinates on the X-Y plane. …
原文链接: https://leetcode-cn.com/problems/sort-array-by-increasing-frequency 英文原文Given an array of integers nums, sort the array in increasing order based on the frequency of the values. If multiple values have the same frequency, sort them in decreasin…
原文链接: https://leetcode-cn.com/problems/widest-vertical-area-between-two-points-containing-no-points 英文原文Given n points on a 2D plane where points[i] = [xi, yi], Return the widest vertical area between two points such that no points are inside the are…
原文链接: https://leetcode-cn.com/problems/number-of-ways-to-form-a-target-string-given-a-dictionary 英文原文You are given a list of strings of the same length words and a string target. Your task is to form target using the given words under the following r…
原文链接: https://leetcode-cn.com/problems/best-team-with-no-conflicts 英文原文You are the manager of a basketball team. For the upcoming tournament, you want to choose the team with the highest overall score. The score of the team is the sum of scores of al…
原文链接: https://leetcode-cn.com/problems/slowest-key 英文原文A newly designed keypad was tested, where a tester pressed a sequence of n keys, one at a time. You are given a string keysPressed of length n, where keysPressed[i] was the ith key pressed in the…
原文链接: https://leetcode-cn.com/problems/arithmetic-subarrays 英文原文A sequence of numbers is called arithmetic if it consists of at least two elements, and the difference between every two consecutive elements is the same. More formally, a sequence s is …
原文链接: https://leetcode-cn.com/problems/path-with-minimum-effort 英文原文You are a hiker preparing for an upcoming hike. You are given heights, a 2D array of size rows x columns, where heights[row][col] represents the height of cell (row, col). You are si…
原文链接: https://leetcode-cn.com/problems/defuse-the-bomb 英文原文You have a bomb to defuse, and your time is running out! Your informer will provide you with a circular array code of length of n and a key k. To decrypt the code, you must replace every numb…
原文链接: https://leetcode-cn.com/problems/minimum-jumps-to-reach-home 英文原文A certain bug's home is on the x-axis at position x. Help them get there from position 0. The bug jumps according to the following rules: It can jump exactly a positions forward (…
原文链接: https://leetcode-cn.com/problems/distribute-repeating-integers 英文原文You are given an array of n integers, nums, where there are at most 50 unique values in the array. You are also given an array of m customer order quantities, quantity, where qu…
原文链接: https://leetcode-cn.com/problems/check-array-formation-through-concatenation 英文原文You are given an array of distinct integers arr and an array of integer arrays pieces, where the integers in pieces are distinct. Your goal is to form arr by conca…
原文链接: https://leetcode-cn.com/problems/furthest-building-you-can-reach 英文原文You are given an integer array heights representing the heights of buildings, some bricks, and some ladders. You start your journey from building 0 and move to the next buildi…
原文链接: https://leetcode-cn.com/problems/minimum-number-of-removals-to-make-mountain-array 英文原文You may recall that an array arr is a mountain array if and only if: arr.length >= 3 There exists some index i (0-indexed) with 0 < i < arr.length - 1 such t…
原文链接: https://leetcode-cn.com/problems/design-front-middle-back-queue 英文原文Design a queue that supports push and pop operations in the front, middle, and back. Implement the FrontMiddleBack class: FrontMiddleBack() Initializes the queue. void pushFron…