For this problem, what is the purpose of x and y ??
I think these two parameters are redundant , considering all the black pixels are connected.
There is only one black block existed in the matrix, so the result is unique.
Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.