i got write output by giving custom inputs,so why not testcases are passing
please check my code
Why testcases are not passing?
Hi @uthyasani
You are getting correct answer for the test case where n and m have the same value, but for different values of n and m you are getting wrong answer because in the while loop you are using n in place of m and vice versa, so all you need to do is that interchange n and m in the while loop and also in the if and for loop in that while loop. Try to do a dry run for a test case with different values of n and m, then you will understand what mistake you are making.
Here is your corrected code :
If your doubt is clear then mark it as 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.