Question d’entretien chez Visa Inc.

Leetcode question, trying practice on leetcode