Halodoc interview question

How to optimize the code (structure data)