Remove the wrong algorithm to count the connected components in an 2D grid