I was trying this problem on spoj - http://www.spoj.com/problems/BITMAP
I am pushing all the white cells on a queue, and performing a BFS. The soultion times out. Here is my code - http://ideone.com/kJDx68
Please see if anyone can help me with this.
Thanks in advance.