Hello Coders, I have participated in an algorithm optimization contest organized by HackRush IIT Gandhinagar. The contest had one question, and the time to solve the question was 36 hours. I found the question interesting; I posted the question and my solution. If anyone has a better approach, please post it.
folder also contain checker. link