Pregunta de entrevista de Visa Inc.

Leetcode question, trying practice on leetcode