TD interview question

Reverse a string with respect to spaces.

Interview Answer

Anonymous

31 July 2021

We can ask the interviewer if we are allowed to allocate some extra space like a character array. If yes, then just populate the array with all those characters from the string. Create a function that does a basic swamping process, the first pointer starting from the first index of the array and the second pointer starting from the last index.