Software Engineer • Mid-Level
Software Engineer • Mid-Level
High QualityPractice Other Questions that TikTok Asked
Continue with targeted prep from TikTok's coding question bank and system design questions.
Interview Summary
the overall process was quite difficult, and I ultimately did not complete the team-matching stage. All three onsite rounds involved algorithmic coding problems, covering constrained string generation, virus containment using graph traversal, and parsing nested chemical formulas.
Interview Details
Round 1 — Coding: Lexicographically Smallest Generated String
The first round involved a string construction problem based on LeetCode 3474, Lexicographically Smallest Generated String. Given two strings, str1 and str2, the task was to construct the lexicographically smallest string satisfying a collection of substring constraints.
The inputs were defined as follows:
str1has lengthnand contains only the characters'T'and'F'.str2has lengthm.- The generated string must have length
n + m - 1.
For each index i in str1, the substring of the generated string beginning at position i and having length m must satisfy the following conditions:
- If
str1[i] == 'T': The substring must be exactly equal tostr2. - If
str1[i] == 'F': The substring must be different fromstr2.
The goal was to return the lexicographically smallest string satisfying every condition. If no valid string could be constructed, the function should return an empty string. The problem required handling overlapping substring constraints, detecting
Unlock Full Details
Create a free account to unlock this interview experience report.