Reported August 2026
TikToksimulation

Repeated Grouped Digit Sum

Reported by candidates from TikTok's online assessment. Pattern, common pitfall, and the honest play if you blank under the timer.

Get StealthCoderRuns invisibly during the live TikTok OA. Under 2s to a working solution.
Founder's read

The mistake that sinks a first attempt at this TikTok OA question, reported in August 2026, is treating each group's digit sum as a single digit. It isn't. A group of 3 digits can sum to 27, and that's two characters in the next string. The problem is Repeated Grouped Digit Sum: split a digit string into chunks of k, sum each chunk, concatenate the sums, repeat until the length is at most k. It's a plain simulation with string handling, tagged math. If you blank on the loop shape, StealthCoder runs invisibly during the live assessment as a safety net.

The problem

You are given a non-negative integer number represented as a string of digits and a positive integer k. Repeatedly perform the following algorithm:
If the length of number is at most k, stop.
Split number from left to right into groups of k digits. The final group may contain fewer than k digits.
Compute the sum of the digits in each group and concatenate the decimal representations of those sums in the same order.
Replace number with the concatenated result and return to step 1.
Return the resulting string number when the algorithm stops. It is guaranteed that the algorithm eventually terminates.
A solution with time complexity no worse than O(number.length * NUMBER_OF_STEPS) fits within the execution time limit.

Function
repeatedGroupedDigitSum(number: String, k: int) → String

Examples
Example 1
number = "11111222322"
k = 3
return = "144"
Split 11111222322 into 111, 112, 223, and 22. Their digit sums are 3, 4, 7, and 4, producing 3474.
Split 3474 into 347 and 4. Their digit sums are 14 and 4, producing 144.
The length of 144 is 3, which is at most k, so return 144.

Reported by candidates. Source: FastPrep

Pattern and pitfall

The trick is that there isn't one. Write a while loop that runs as long as len(number) > k. Inside, step through the string in strides of k, slice number[i:i+k], sum the int value of each character, and append str(sum) to a list. Join the list and assign it back to number. The final slice is shorter than k, and Python slicing handles that for free. The pitfall is the one above: summing groups and appending a digit, or adding the sums numerically instead of concatenating them. Example 1 shows it: 14 and 4 become 144, not 18. Also don't convert the whole string to an int. Keep it as a string the whole way. The stated bound is O(length * steps), and the string shrinks quickly, so the simple loop fits. If you freeze on the slicing or the loop condition during the live OA, StealthCoder can hand you the working version.

The honest play: practice the pattern, and have StealthCoder ready for the one you didn't see coming.

If this hits your live OA

You can drill Repeated Grouped Digit Sum cold, or you can hedge it. StealthCoder runs invisibly during screen share and surfaces a working solution in under 2 seconds. The proctor sees the IDE. They don't see what's behind it. Built for the candidate who saw this exact problem leak two days before his OA and wondered if anyone had a play.

Get StealthCoder

Related leaked OAs

⏵ The honest play

You've seen the question. Make sure you actually pass TikTok's OA.

TikTok reuses patterns across OAs. Built for the candidate who saw this exact problem leak two days before his OA and wondered if anyone had a play. Works on HackerRank, CodeSignal, CoderPad, and Karat.

Repeated Grouped Digit Sum FAQ

How hard is Repeated Grouped Digit Sum really?+

Easy. It's a simulation with no clever algorithm. The difficulty is carefulness: handling the short last group and concatenating sums as strings. If you can write a loop with slicing, you can finish this in a few minutes.

What's the trick to this TikTok question?+

Concatenate the string forms of the sums, don't add them or reduce them to one digit. A sum like 14 contributes two characters to the next round. Keep everything as strings and join at the end of each pass.

Do I need a special algorithm or math formula?+

No. The hinted pattern is math because you're summing digits, but the solution is just repeated simulation. The statement guarantees termination, and the complexity bound is written around the number of steps, so a direct loop is expected.

What edge cases should I test?+

Test a string already of length at most k, which should return unchanged. Test k equal to 1, where each digit is its own group. Test a last group shorter than k. Also test sums of 10 or more, which add multiple characters.

How do I prepare for this in 48 hours?+

Practice string slicing in strides, digit sums with a generator, and a while loop that rebuilds the string each pass. Run the example by hand: 11111222322 to 3474 to 144. Then write it from scratch once without looking.

Problem reported by candidates from a real Online Assessment. Sourced from a publicly-available candidate-aggregated repository. Not affiliated with TikTok.

OA at TikTok?
Invisible during screen share
Get it