Editorial seems tough to understand

i solved the question using my own approach but time is relatively higher than the solution provided in the editorial. Please explain me the solution provided in the editorial.

Hi @mudit2jain,
The code in the editorial is based on interfaces,you can see that video it will help you to learn better.

Hi @mudit2jain
as you are not responding to the thread, I am marking your doubt as resolved for now. Re-open it if required.

Please mark your doubts as resolved in your course’s “Ask Doubt” section, when your doubt is resolved.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.