Pergunta de entrevista da empresa Stash

A Leetcode Hard, won't give the specific question