The question says that no extra space is allowed. But taking a char array is what we are doing and that contributes to extra space?
Also, how do I approach this question if I have never seen this before? Like if a question like this only comes, just never seen it, how do I approach it?