You don't need to take vector for this you can have input in array also.
You just need to check the elements in each partition .
On 12-Jul-2013 8:27 PM, "Don" wrote:
> Can anyone modify this solution so that it does not duplicate the memory
> at each level of recursion?
>
> (Here is my solution w
pick '0' and keep track if we have visited that '0' before
a '0' will not surrender if it is on boundary
a '0' is ready to surrender if
1. it is surrounded by no '0' in all 4 directions (easy one)
or
2. if it is surrounded by 1 to 4 '0' then it will surrender but we will ask
each of the neighbo