Only one test cases got passed

Hello @Pranav_Chaudhary

I have modified your code:

Refer to the comments for better understanding.
The modification done is as per the requirement of the output format.

Hope, this would help.

Hello @Pranav_Chaudhary,

I have done few modification in your code, you can check:

Points to Consider:

  1. No need to swap back

  2. When you use char array, then the changes made in it are reflected back to the block that has called the function.
    i.e. changes in formal parameters are reflected back in the actual parameter.
    Solution: You can use string as it does not reflect back the changes

    If you would use array, then you have to return the char array in that you accepted as input to the array without imposing any changes that are done in the current functional block.

    Then, this returned array is assigned to in array of calling functional block.

Let me know if you don’t understand this.

Hope, you have understood the reason why i suggested to use string in my previous reply.
Give a like, if you are satisfied.

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.