This was a standard LeetCode question. You should prepare for the top 100 questions, and you'll find one of them here. Practice and prepare, and know your LeetCode topics deeply. You'll be able to solve it.
It was a question about recursion.
The following metrics were computed from 411 interview experiences for the TikTok Software Engineer role in United States.
TikTok's interview process for their Software Engineer roles in the United States is extremely selective, failing the vast majority of engineers.
Candidates reported having mixed feelings for TikTok's Software Engineer interview process in United States.