TXIO Corp interview question

Leetcode Easy/Medium