Given two character arrays a[] and b[], remove from b[],all occurrences of all characters that occur in array a[]. You need to do this in-place i.e. without using an extra array of characters. E.g.:
If you don't want to use another array, and you don't want empty array positions, what do you think your other options are? You could shift everything down an index, but then you'd still have empty array positions at the end of the array. Are you sure you're understanding your requirements correctly?
This is requirement
1> No empty Array Positions after returning the Array
2> Dont use an extra Array for your operation.
This is what the question says clearly.This was asked by interviewer himself and he said there exists a solution but when i asked him,he asked me to try it for myself.
"Any fool can write code that a computer can understand. Good programmers write code that humans can understand." --- Martin Fowler
Please correct my English.
There is no solution with these requirements. You want to go from a 6-element array to a 2-element array without creating a new array or having empty positions. That's simply not possible.