Pergunta de entrevista da empresa Visa Inc.

Leetcode question, trying practice on leetcode