Out of 4 , 3 of them are passes one is getting run-error ? Can you help where i am going wrong ? And run-error is same as TLE ?
Getting Run-Error
Finding maximum element from start to end again and again is costing you a lot of time.
It will be better if you memorize the locations of digits, and then just easily swap digits if required.
You can also solve this by maintaining hash_map to store indexes and swap easily.
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.