Pergunta de entrevista da empresa Audible

The exam room question on leetcode (LC 855)