See my Code it has passed all test cases.
it’s my approach, tell me it efficient code on the of complexity.
randomly i have come to an idea and I coded it.
surprisingly it has passed all test cases.
Once see it let me know also another way to solve it.