Pergunta de entrevista da empresa Google

Two DSA qs and solved both brute force and optimal for each