Microsoft Interview Question

The interviewer asked me how I would remove a specific character from a character array.

Interview Answers

Anonymous

Jan 28, 2019

Iterate through the array, and for every character not equal to the specific character in question append it to a dynamic data structure (I used ArrayList). Return the data structure after you finish iterating through the original character array.

Anonymous

Feb 19, 2019

I wonder if they wanted you to use no extra space instead.you could do by keeping track of how many of such character exist and shift the other characters to left accordingly and resize and return.