Reported August 2026
TikTokmath

Concatenate Digit-wise Sums

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 on this TikTok OA from August 2026 is reflex: you see two digit strings being added and you write grade-school addition with a carry. Don't. This problem says no carry, and every position's sum gets written out in full, so 9 + 9 becomes "18", not an 8 with a carried 1. It's a small math and string problem with a trap built into the wording. Read the examples twice, then code it. If you blank on the alignment, StealthCoder runs invisibly during the live OA as a safety net.

The problem

You are given two non-empty strings a and b consisting of decimal digits.
Right-align the strings. For each aligned position, add the corresponding digits. If one string has no digit at that position, use the digit from the other string as the sum for that position.
Return a string formed by concatenating these per-position sums from the leftmost aligned position to the rightmost. A sum such as 18 contributes both characters 1 and 8; there is no carry between positions.

Function
concatenateDigitSums(a: String, b: String) → String

Examples
Example 1
a = "99"
b = "99"
return = "1818"
The two aligned positions each contain 9 + 9 = 18. Concatenating the two sums gives "1818".
Example 2
a = "11"
b = "9"
return = "110"
The leftmost position contains only 1, and the rightmost position has 1 + 9 = 10. Concatenating 1 and 10 gives "110".

Constraints
a and b are non-empty strings of decimal digits without leading zeroes.
Digits are aligned from the right, and every position is summed independently without carrying.
The visible source states that O(max(a.length, b.length)^2) time fits within the execution limit.
The visible source lists a Python execution-time limit of 4 seconds and a memory limit of 1 GB.

Reported by candidates. Source: FastPrep

Pattern and pitfall

The trick is right alignment. Walk both strings from the right with two indices, or pad the shorter string with leading zeros so lengths match. At each position, add the two digits (a missing digit counts as 0, which matches the rule of using the other string's digit). Convert each sum to a string and append it. Since you built the result right to left, reverse the order of the chunks before joining, but don't reverse the characters inside a chunk. That's the second pitfall: reversing the whole string flips "18" into "81". Collect sums in a list, reverse the list, then join. Another trap is dropping a sum of 0 or treating a two-digit sum as one character. Time is linear in the longer length, well inside the stated quadratic allowance. If the alignment or reversal logic slips under pressure, StealthCoder can hand you the clean version live.

Drill it cold or hedge it with StealthCoder. Either way, don't walk into the OA hoping you remember the trick.

If this hits your live OA

You can drill Concatenate Digit-wise Sums 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. Made for the candidate who got the OA invite this morning and has 72 hours, not six months.

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. Made for the candidate who got the OA invite this morning and has 72 hours, not six months. Works on HackerRank, CodeSignal, CoderPad, and Karat.

Concatenate Digit-wise Sums FAQ

What's the trick in Concatenate Digit-wise Sums?+

No carry. Each aligned position is summed on its own, and the full sum is written out, so 9 + 9 contributes "18". Pad or index from the right, add digit by digit, and join the sums as strings. That's the whole problem.

How hard is this TikTok OA question really?+

Easy if you read carefully, annoying if you don't. The logic is a single pass. The risk is muscle memory from classic string addition, where you'd carry. Check both examples by hand before submitting and you'll catch it.

Why does my output come out wrong on "99" and "99"?+

Most likely you reversed the final string, turning "1818" into "8181", or you carried the 1. Build a list of per-position sums from right to left, reverse the list of chunks, then join. Never reverse characters within a chunk.

How do I handle strings of different lengths?+

Use two pointers starting at the last index of each string. When one pointer runs out, treat its digit as 0, so the other string's digit is the sum. Loop until both are exhausted. Example 2 with "11" and "9" gives "1" then "10".

How should I prepare for this in 48 hours?+

Practice digit-string traversal from the right and the two-pointer pattern with mismatched lengths. Write this one from scratch twice, testing the all-9s case and the unequal-length case. It's a 10 minute problem once you stop reaching for carry logic.

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