Citadel interview question

Classic brainteasers and coding problems on leetcode.