← 返回 bytedance 的题目列表Adjust Video Scores
类型:online_judge
Given an array videoScores of length n representing current relevance scores of videos in the recommendation system (higher values indicating better matches), the task is to adjust the scores to make all videos no longer recommended (i.e., reduce all scores to 0 or below). Each adjustment decreases one of the video scores by a fixed integer value x. Find the minimum x such that after performing at most maxAdjustments adjustments, all scores become non-positive.
Example:
Input: videoScores = [1, 2, 3], maxAdjustments = 4 Output: 2
Explanation: If x = 1, it would take more than 4 adjustments to make all scores non-positive. With x = 2, each element can be decreased adequately within 6 adjustments.
Example
Input
{'videoScores': [1, 2, 3], 'maxAdjustments': 4}