Unlock doubt map

I am not getting why to use map ? if it can be solve using array my code:


but showing error

@guptashubham210a
Nested loop will be O(n^2), to do it in less than that, any preprocessing would certainly help using maps

array can be used this way