Antra Interview Question

coding question about the map and follow up