FastPrepMaximum Positive Feedback
Problems/Maximum Positive Feedback

Maximum Positive Feedback

TikTok logoTikTok● MediumOA

Updated Sep 2026

QuestionFunctionExamples

Problem statement

The other quesiton in the same batch was posted on our Discord server oa-update channel.

The TikTok Content creator's videos receives feedback from viewers over time, represented as a binary string, videoFeedback:

  • 1 indicates positive reactions(likes, shares, or comments).
  • 0 indicates negative reactions(skips or dislikes).

The creator wants to improve a video's overall positive reception by strategically targeting a portion of the video for editing or improvement. Here's the strategy:

  • Choose one specific segment of the video(interval [i, j]) to leave unchanged, where i > 0 and j < videoFeedback_size.
  • Outside this segment, the plan is to completely change the content—flipping negative reactions to positive(0 to 1) and positive reactions to negative(1 to 0).

The objective is to maximize the total positive feedback(1s) for the entire video after performing this operation.

Note: The operation must be performed only once.

Function

getMaxPositiveFeedback(videoFeedback: String) → int

Complete the function getMaxPositiveFeedback in the editor.

getMaxPositiveFeedback has the following parameter:

  • string videoFeedback: a binary string representing the feedback on a video, where 1 represents positive feedback and 0 represents negative reaction

Examples

Example 1

videoFeedback = "100110"return = 5

Given videoFeedback_size = 6 and videoFeedback = "100110", The interval i = 4 to j = 5 can be selected as the unchanged segment of the video. Flipping the bits from index 1 to 3 transforms the string from "100110" to "011110". Next, flipping the bit at index 6 (i.e., the last bit) changes the string from "011110" to "011111". As this string contains 5 ones, the output should be 5. There are no intervals that produce an output greater than 5.

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 Redundancy After One Segment FlipBloomberg LP · OABloomberg LP interview questions
  • Maximum Equal-Bit Pairs in a SubsequenceAmazon · OA
  • Earliest Time to Schedule a MeetingMathWorks · OAMathWorks interview questions
  • Earliest Meeting Start on a 24-Hour ClockIMC Trading · OAIMC Trading interview questions
  • Longest Subsequence That Is a SubstringBooking.com · OA
  • Count Digit Replacements with No Equal Adjacent DigitsMicrosoft · OAMicrosoft interview questions
  • Palindrome CounterGoldman Sachs · OAGoldman Sachs interview questions
  • Maximum Equalized Substrings After One Adjacent SwapVisa · OAVisa interview questions
  • Minimum-Cost Digit String DecodingSquadStack.ai · OA
  • Balanced Split String with WildcardsTwo Sigma · OATwo Sigma 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 getMaxPositiveFeedback(String videoFeedback) {
      // write your code here
    }

}
Checking account…