I have a doubt regarding the Algo

I just wanted to ask if this question needs use of hashtable or maps, I was not able to do it so o looked up to youtube and initial 1-2 tutorials were either using hasttable or maps.

Yes you have to use maps to solve this question

i guess the same goes for the top view as well

Yes…