全站内容
hard
123. Best Time to Buy and Sell Stock III
#Problem You are given an array prices where prices[i] is the price of a given stock on the iᵗʰ day. Find the maximum profit you can achieve. You may complete at most two transactions. Note: You may not engage in multiple transactions …
2809. Minimum Time to Make Array Sum At Most x
#Problem You are given two 0-indexed integer arrays nums1 and nums2 of equal length. Every second, for all indices 0 <= i < nums1.length, value of nums1[i] is incremented by nums2[i]. After this is done, you can do the following operation: …
3266. Final Array State After K Multiplication Operations II
#Problem You are given an integer array nums, an integer k, and an integer multiplier. You need to perform k operations on nums. In each operation: Find the minimum value x in nums. If there are multiple occurrences of the minimum value, …
2931. Maximum Spending After Buying Items
#Problem You are given a 0-indexed m * n integer matrix values, representing the values of m * n different items in m different shops. Each shop has n items where the jᵗʰ item in the iᵗʰ shop has a value of values[i][j]. Additionally, the …
2699. Modify Graph Edge Weights
#Problem You are given an undirected weighted connected graph containing n nodes labeled from 0 to n - 1, and an integer array edges where edges[i] = [aᵢ, bᵢ, wᵢ] indicates that there is an edge between nodes aᵢ and bᵢ with weight wᵢ. Some …
1719. Number Of Ways To Reconstruct A Tree
#Problem You are given an array pairs, where pairs[i] = [xᵢ, yᵢ], and: There are no duplicates. xᵢ < yᵢ Let ways be the number of rooted trees that satisfy the following conditions: The tree consists of nodes whose values appeared in pairs. …
1982. Find Array Given Subset Sums
#Problem You are given an integer n representing the length of an unknown array that you are trying to recover. You are also given an array sums containing the values of all 2ⁿ subset sums of the unknown array (in no particular order). …
782. Transform to Chessboard
#Problem 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 the board into a chessboard board. If the task …
2056. Number of Valid Move Combinations On Chessboard
#Problem There is an 8 x 8 chessboard containing n pieces (rooks, queens, or bishops). You are given a string array pieces of length n, where pieces[i] describes the type (rook, queen, or bishop) of the iᵗʰ piece. In addition, you are given …
52. N-Queens II
#Problem The n-queens puzzle is the problem of placing n queens on an n x n chessboard such that no two queens attack each other. Given an integer n, return the number of distinct solutions to the n-queens puzzle. …