原文链接: https://leetcode-cn.com/problems/minimum-difficulty-of-a-job-schedule 英文原文You want to schedule a list of jobs in d days. Jobs are dependent (i.e To work on the i-th job, you have to finish all the jobs j where 0 <= j < i). You have to finish at…
标签详情
数组 分类
原文链接: https://leetcode-cn.com/problems/sort-integers-by-the-number-of-1-bits 英文原文Given an integer array arr. You have to sort the integers in the array in ascending order by the number of 1's in their binary representation and in case of two or more …
原文链接: https://leetcode-cn.com/problems/apply-discount-every-n-orders 英文原文There is a supermarket that is frequented by many customers. The products sold at the supermarket are represented as two parallel integer arrays products and prices, where the i…
原文链接: https://leetcode-cn.com/problems/the-k-weakest-rows-in-a-matrix 英文原文You are given an m x n binary matrix mat of 1's (representing soldiers) and 0's (representing civilians). The soldiers are positioned in front of the civilians. That is, all th…
原文链接: https://leetcode-cn.com/problems/reduce-array-size-to-the-half 英文原文You are given an integer array arr. You can choose a set of integers and remove all the occurrences of these integers in the array. Return the minimum size of the set so that at…
原文链接: https://leetcode-cn.com/problems/jump-game-v 英文原文Given an array of integers arr and an integer d. In one step you can jump from index i to index: i + x where: i + x < arr.length and 0 < x <= d. i - x where: i - x >= 0 and 0 < x <= d. In additio…
原文链接: https://leetcode-cn.com/problems/check-if-n-and-its-double-exist 英文原文Given an array arr of integers, check if there exists two integers N and M such that N is the double of M ( i.e. N = 2 * M). More formally check if there exists two indices i …
原文链接: https://leetcode-cn.com/problems/maximum-students-taking-exam 英文原文Given a m * n matrix seats that represent seats distributions in a classroom. If a seat is broken, it is denoted by '#' character otherwise it is denoted by a '.' character. Stud…
原文链接: https://leetcode-cn.com/problems/count-negative-numbers-in-a-sorted-matrix 英文原文Given a m x n matrix grid which is sorted in non-increasing order both row-wise and column-wise, return the number of negative numbers in grid. Example 1: Input: gri…
原文链接: https://leetcode-cn.com/problems/product-of-the-last-k-numbers 英文原文Design an algorithm that accepts a stream of integers and retrieves the product of the last k integers of the stream. Implement the ProductOfNumbers class: ProductOfNumbers() In…
原文链接: https://leetcode-cn.com/problems/maximum-number-of-events-that-can-be-attended 英文原文Given an array of events where events[i] = [startDayi, endDayi]. Every event i starts at startDayi and ends at endDayi. You can attend an event i at any day d wh…
原文链接: https://leetcode-cn.com/problems/construct-target-array-with-multiple-sums 英文原文You are given an array target of n integers. From a starting array arr consisting of n 1's, you may perform the following procedure : let x be the sum of all element…
原文链接: https://leetcode-cn.com/problems/how-many-numbers-are-smaller-than-the-current-number 英文原文Given the array nums, for each nums[i] find out how many numbers in the array are smaller than it. That is, for each nums[i] you have to count the number …
原文链接: https://leetcode-cn.com/problems/minimum-cost-to-make-at-least-one-valid-path-in-a-grid 英文原文Given a m x n grid. Each cell of the grid has a sign pointing to the next cell you should visit if you are currently in this cell. The sign of grid[i][j…
原文链接: https://leetcode-cn.com/problems/find-the-distance-value-between-two-arrays 英文原文Given two integer arrays arr1 and arr2, and the integer d, return the distance value between the two arrays. The distance value is defined as the number of elements…
原文链接: https://leetcode-cn.com/problems/cinema-seat-allocation 英文原文 A cinema has n rows of seats, numbered from 1 to n and there are ten seats in each row, labelled from 1 to 10 as shown in the figure above. Given the array reservedSeats containing th…
原文链接: https://leetcode-cn.com/problems/pizza-with-3n-slices 英文原文There is a pizza with 3n slices of varying size, you and your friends will take slices of pizza as follows: You will pick any pizza slice. Your friend Alice will pick next slice in anti …
原文链接: https://leetcode-cn.com/problems/bulb-switcher-iii 英文原文There is a room with n bulbs, numbered from 1 to n, arranged in a row from left to right. Initially, all the bulbs are turned off. At moment k (for k from 0 to n - 1), we turn on the light[…
原文链接: https://leetcode-cn.com/problems/lucky-numbers-in-a-matrix 英文原文Given an m x n matrix of distinct numbers, return all lucky numbers in the matrix in any order. A lucky number is an element of the matrix such that it is the minimum element in its…
原文链接: https://leetcode-cn.com/problems/design-a-stack-with-increment-operation 英文原文Design a stack which supports the following operations. Implement the CustomStack class: CustomStack(int maxSize) Initializes the object with maxSize which is the maxi…
原文链接: https://leetcode-cn.com/problems/maximum-performance-of-a-team 英文原文You are given two integers n and k and two integer arrays speed and efficiency both of length n. There are n engineers numbered from 1 to n. speed[i] and efficiency[i] represent…
原文链接: https://leetcode-cn.com/problems/reducing-dishes 英文原文A chef has collected data on the satisfaction level of his n dishes. Chef can cook any dish in 1 unit of time. Like-time coefficient of a dish is defined as the time taken to cook that dish i…
原文链接: https://leetcode-cn.com/problems/check-if-there-is-a-valid-path-in-a-grid 英文原文Given a m x n grid. Each cell of the grid represents a street. The street of grid[i][j] can be: 1 which means a street connecting the left cell and the right cell. 2 …
原文链接: https://leetcode-cn.com/problems/find-lucky-integer-in-an-array 英文原文Given an array of integers arr, a lucky integer is an integer which has a frequency in the array equal to its value. Return a lucky integer in the array. If there are multiple …
原文链接: https://leetcode-cn.com/problems/count-number-of-teams 英文原文There are n soldiers standing in a line. Each soldier is assigned a unique rating value. You have to form a team of 3 soldiers amongst them under the following rules: Choose 3 soldiers …
原文链接: https://leetcode-cn.com/problems/minimum-value-to-get-positive-step-by-step-sum 英文原文Given an array of integers nums, you start with an initial positive value startValue. In each iteration, you calculate the step by step sum of startValue plus e…
原文链接: https://leetcode-cn.com/problems/minimum-subsequence-in-non-increasing-order 英文原文Given the array nums, obtain a subsequence of the array whose sum of elements is strictly greater than the sum of the non included elements in such subsequence. If…
原文链接: https://leetcode-cn.com/problems/stone-game-iii 英文原文Alice and Bob continue their games with piles of stones. There are several stones arranged in a row, and each stone has an associated value which is an integer given in the array stoneValue. A…
原文链接: https://leetcode-cn.com/problems/queries-on-a-permutation-with-key 英文原文Given the array queries of positive integers between 1 and m, you have to process all queries[i] (from i=0 to i=queries.length-1) according to the following rules: In the be…
原文链接: https://leetcode-cn.com/problems/kids-with-the-greatest-number-of-candies 英文原文There are n kids with candies. You are given an integer array candies, where each candies[i] represents the number of candies the ith kid has, and an integer extraCan…