Pergunta de entrevista da empresa Rippling

The coding question is the leetcode hard question. and the interviewer was unhappy to see that i can solve the problem perfectly. I guess he wants to see candidates fail rather than succeed.