全站内容
medium
2054. Two Best Non-Overlapping Events
#Problem You are given a 0-indexed 2D integer array of events where events[i] = [startTimeᵢ, endTimeᵢ, valueᵢ]. The iᵗʰ event starts at startTimeᵢ and ends at endTimeᵢ, and if you attend this event, you will receive a value of valueᵢ. You …
1760. Minimum Limit of Balls in a Bag
#Problem You are given an integer array nums where the iᵗʰ bag contains nums[i] balls. You are also given an integer maxOperations. You can perform the following operation at most maxOperations times: Take any bag of balls and divide it …
688. Knight Probability in Chessboard
#Problem On an n x n chessboard, a knight starts at the cell (row, column) and attempts to make exactly k moves. The rows and columns are 0-indexed, so the top-left cell is (0, 0), and the bottom-right cell is (n - 1, n - 1). A chess knight …
2554. Maximum Number of Integers to Choose From a Range I
#Problem You are given an integer array banned and two integers n and maxSum. You are choosing some number of integers following the below rules: The chosen integers have to be in the range [1, n]. Each integer can be chosen at most once. …
2337. Move Pieces to Obtain a String
#Problem You are given two strings start and target, both of length n. Each string consists only of the characters 'L', 'R', and '_' where: The characters 'L' and 'R' represent pieces, where a piece 'L' can move to the left only if there is …
3001. Minimum Moves to Capture The Queen
#Problem There is a 1-indexed 8 x 8 chessboard containing 3 pieces. You are given 6 integers a, b, c, d, e, and f where: (a, b) denotes the position of the white rook. (c, d) denotes the position of the white bishop. (e, f) denotes the …
2825. Make String a Subsequence Using Cyclic Increments
#Problem You are given two 0-indexed strings str1 and str2. In an operation, you select a set of indices in str1, and for each index i in the set, increment str1[i] to the next character cyclically. That is 'a' becomes 'b', 'b' becomes 'c', …
2109. Adding Spaces to a String
#Problem You are given a 0-indexed string s and a 0-indexed integer array spaces that describes the indices in the original string where spaces will be added. Each space should be inserted before the character at the given index. For …
443. String Compression
#Problem Given an array of characters chars, compress it using the following algorithm: Begin with an empty string s. For each group of consecutive repeating characters in chars: If the group’s length is 1, append the character to s. …
3254. Find the Power of K-Size Subarrays I
#Problem You are given an array of integers nums of length n and a positive integer k. The power of an array is defined as: Its maximum element if all of its elements are consecutive and sorted in ascending order. -1 otherwise. You need to …