TikTok Interview Question

A backtracking question and ML knowledge