Globant Interview Question

Algorithm had to be at worst N Log N time and spatial complexity.