FastPrepTikTok Video Relevance Adjustment
Problems/TikTok Video Relevance Adjustment

TikTok Video Relevance Adjustment

Amazon logoAmazon● MediumOA

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Given an array videoScores, of length n, representing the current relevance scores of videos in the recommendation system (i.e., how much a video matches the user's interests, with higher values indicating better matches), the task is to adjust the scores to make all the videos no longer recommended (i.e., reduce all the scores to 0 or below).

Each adjustment decreases one of the video scores by a fixed integer value x. The task is to find the minimum value of x such that after performing at most maxAdjustments adjustments, all the relevance scores will become non-positive (i.e., less than or equal to zero).

Function

getMinAdjustments(videoScores: int[], maxAdjustments: int) → int

Complete the function getMinAdjustments in the editor below.

getMinAdjustments takes the following parameters:

  1. int videoScores[n]: the current relevance scores of videos in the recommendation system
  2. int maxAdjustments: the maximum number of adjustments allowed

Returns int: the minimum possible integer x required

Examples

Example 1

videoScores = [4, 3, 2, 7]maxAdjustments = 5return = 4

With step x, a score v needs ceil(v / x) adjustments to reach 0 or below. With x = 3 the scores need 2 + 1 + 1 + 3 = 7 adjustments, more than 5. With x = 4 they need 1 + 1 + 1 + 2 = 5 adjustments, which is allowed. Smaller steps need even more adjustments (16 for x = 1, 9 for x = 2), so the minimum x is 4.

Example 2

videoScores = [1, 2, 3]maxAdjustments = 4return = 2

With x = 1 the scores need 1 + 2 + 3 = 6 adjustments, more than 4. With x = 2: decrease the first score: [-1, 2, 3]; decrease the second score: [-1, 0, 3]; decrease the third score: [-1, 0, 1]; decrease the third score again: [-1, 0, -1]. That is 4 adjustments and every score is at most 0, so the minimum x is 2.

Constraints

  • 1 <= n <= 10^5, where n is the length of videoScores
  • 1 <= videoScores[i] <= 10^9
  • n <= maxAdjustments <= 10^9

More Amazon interview questions

  • LRU Cache for Query ResultsPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Maximal SquareONSITE INTERVIEW · Seen Nov 2026
  • Serialize and Deserialize a Binary TreeONSITE INTERVIEW · Seen Nov 2026
  • Course SchedulePHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Course Schedule IIPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Diagonal Traversal of a Binary TreeONSITE INTERVIEW · Seen Nov 2026
  • Minimum Time to Spread Through a GridPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Consistent-Hash Packet RouterPHONE SCREEN · Seen Nov 2026
  • Count Connected ComponentsPHONE SCREEN · Seen Nov 2026
  • Maximize K-Element AND with an Increment BudgetOA · Seen Nov 2026

Similar questions at other companies

  • Server Upgrade PlanningWells Fargo · OAWells Fargo interview questions
  • Find Minimum TimeAlphaSense · OA
  • Find Minimum TimeBlackRock · OABlackRock interview questions
  • Maximize Pipeline Throughput Under a Scaling BudgetMicrosoft · OAMicrosoft interview questions
  • Rock JumpingIMC Trading · OAIMC Trading interview questions
  • Minimize Maximum Group DifferenceDRW · OADRW interview questions
  • Array NullificationQRT · OA
  • Minimum HeightSnowflake · OASnowflake interview questions
  • Pipeline Throughput Maximization Under BudgetUber · OAUber interview questions
  • Minimum-Cost Solar Rooftop AllocationDeloitte · OADeloitte interview questions

Interview reports that mention this question

  • Amazon Full-Time OA Problems, Earlier Reports (Part 5 of 5)

Amazon interview experiences

  • Amazon Experienced SDE Onsite Questions: 1 Experience
  • Amazon SDE Onsite Interview Questions: 9 Experiences
  • Amazon SDE II and L5 FDE Interview Questions: 4 Experiences
  • Amazon Full-Time OA Problems, Recent Reports (Part 4 of 5)
  • Amazon New Grad OA Problems: Every Task We Have (Part 3 of 5)
See Amazon hiring insights
Saved
class Solution {
    public int getMinAdjustments(int[] videoScores, int maxAdjustments) {
        // write your code here
    }

}
Checking account…