This LeetCode question is DP Hard, and I failed to provide the perfect answer within one hour. However, the interviewer was kind and offered hints during the interview.
How about the time complexity?
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.