FastPrepTikTok Video Relevance Adjustment
Problems/TikTok Video Relevance Adjustment

TikTok Video Relevance Adjustment

TikTok logoTikTok● MediumNEW GRADOA

Updated Sep 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.

getMinAdjustments takes the following parameter:

  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 = [1, 2, 3]maxAdjustments = 4return = 2

If x = 1, elements can be decreased by 1 in an operation and it would take a total of 6 adjustments to make all the elements non-positive which exceeds the maxAdjustments allowed.

If the chosen x = 2, then:

  • In the first operation, we decrease the first element. The array becomes [-1, 2, 3]
  • In the second operation, we decrease the second element. The array becomes [-1, 0, 3]
  • In the third operation, we decrease the third element. The array becomes [-1, 0, 1]
  • In the fourth operation, we decrease the third element again. The array becomes [-1, 0, -1]

Hence, x = 2 is the minimum possible integer respecting the given conditions. Thus, the answer is 2.

Constraints

  • 1 ≤ n ≤ 10^5
  • 1 ≤ videoScores[i] ≤ 10^9
  • n ≤ maxAdjustments ≤ 10^9

More TikTok interview questions

  • Minimum Cost of Every K-Capable Model SetOA · Seen Nov 2026
  • Longest Substring Without Repeating CharactersPHONE SCREEN · Seen Oct 2026
  • Next Greater Indices and Maximum GapPHONE SCREEN · Seen Oct 2026
  • Count Subarrays with at Least K Equal-Fruit PairsOA · Seen Oct 2026
  • Shell Command Counts with History ReferencesOA · Seen Oct 2026
  • Count Subarrays Matching a Comparison PatternOA · Seen Sep 2026
  • Product Minus Sum of DigitsOA · Seen Aug 2026
  • Count 2x2 Submatrices by Black CellsOA · Seen Aug 2026
  • Find All Local PeaksOA · Seen Aug 2026
  • Count Case-Insensitive TripletsOA · Seen Aug 2026

Similar questions at other companies

  • Maximum Alloy Production Within BudgetMicrosoft · OAMicrosoft interview questions
  • Linear InterpolatorTwo Sigma · OATwo Sigma interview questions
  • Rock JumpingIMC Trading · OAIMC Trading interview questions
  • Souvenir Shop PurchasesAmazon · OA
  • Minimum Bonus ProjectsWells Fargo · OAWells Fargo interview questions
  • Random Pick with Weight Using Recorded DrawsGoogle · PHONE SCREEN · ONSITE INTERVIEWGoogle interview questions
  • Koko Eating BananasTekion · ONSITE INTERVIEWTekion interview questions
  • Minimum of a Convex FunctionRippling · PHONE SCREENRippling interview questions
  • Count Centaur Friend RequestsMeta · PHONE SCREENMeta interview questions
  • Percentile and Boundary QueriesDatadog · PHONE SCREENDatadog interview questions

TikTok interview experiences

  • TikTok AI Infra Intern LLM Round 2: 1 Experience
  • TikTok AI Infra Intern DeepSpeed Round: 1 Experience
  • TikTok AI Infra Intern Kernel Round: 1 Experience
  • TikTok AI Infra Intern Interviews, 3 Rounds: 1 Experience
  • TikTok AI Infra Intern Interview Timeline: 1 Experience
  • TikTok AI Infra Intern Onsite Round 2: 1 Experience
All TikTok interview questionsSee TikTok hiring insights
Saved
class Solution {
    public int getMinAdjustments(int[] videoScores, int maxAdjustments) {
      // write your code here
    }

}
Checking account…