Halodoc Interview Question

How to optimize the code (structure data)