Uber interview question

Some coding problem based on map