Turing.com OA Turing Question

Posted
17 Sept 2025
392 reads

Summary

I encountered this specific coding problem during my Online Assessment for Turing.com, which challenged me to construct the largest possible number given certain digit repetition constraints.

How it went

During the Online Assessment for Turing.com, I was presented with a fascinating algorithmic challenge. The goal was to rearrange the digits of a given number string to form the largest possible new number, but with a crucial constraint: no digit could appear continuously more than 'k' times. This problem required careful thought on how to balance maximizing the number while adhering to the repetition limit across the entire string, especially considering the large input size.

Questions asked (1)

  1. 01

    Maximize Number with Repetition Constraint

    Data Structures & Algorithms · Hard

    Given a number string num and an integer k, the task is to find the largest possible number that can be formed by rearranging the digits of num such that no digit appears continuously more than k times.

    Example 1:

    Input: num = "3391933", k = 3
    Output: "9933313"
    Explanation: largest possible number is "9933313", as you can see there is no continuous digit which is more than 3 times and largest number.

    Example 2:

    Input: num = "1121212", k = 2
    Output: "221211"
    Explanation: largest possible number is "221211", as you can see there is no continuous digit which is more than 2 times.

    Constraints:

    • 1 <= k <= num.length <= 10^7
    • num consists of 0 to 9 digits.

Know someone preparing? Send it to them:WhatsAppLinkedInX

Interviewed at Turing.com recently?

Write up your rounds while you still remember the questions. It helps the next person more than you would think.

Share your experience
Discussion 0

Questions for the author, or how your own interview compared.

Join the discussion

Sign in with Google to comment or ask the author a question.

No comments yet

Be the first to share your thoughts and start the discussion!