Intuit interview question

normal toplogic sort questions in leetcode.