Traveloka interview question

Some Code Optimization with Pseudocode