Is there an efficient solution to this problem than O(n^2)
Hello @anshufirefox i think youor O(N^2) approach will also work fine as the constraints are not larger.
Happy Learning!!
could you please help me debug my code, it doesn’t seem to work
Thushar bhaiya reply please
yeah, were you able to find the fault?
Hey @anshufirefox your logic is not finding according to the conditions.
it took me time to understand your logic using n2 approach then i have reimplemented it.
you can check it here:
if you dont understand this you can ask here:
Happy Learning!!
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.