Aquant interview question

Leetcode question - easy/medium (arrays, hashmap)