Problem Name: Name Lookup ; Suggestions for better approach

Question Link: Name Lookup
In this problem, Roll number and Name of students are given. We have to find the name of students for each query of Roll number.

I have done this using HashMap. Please suggest an alternate method to solve this problem.
See my Editorial link: https://www.stopstalk.com/problems/read_editorial/1651

use coordinate compression and string array , that might be a good exercise for you.

Coordinate compression is new to me. I will surely explore it and try to implement it.