If we are just finding a O(mn) solution, why not just simply scan it with largest range on each axis? it's even don't use x/y at all and beat half of solutions

```
public class Solution {
public int minArea(char[][] image, int x, int y) {
if (image.length == 0 || image[0].length == 0) {
return 0;
}
int n = image.length;
int m = image[0].length;
int lengthX = 0;
for (int j = 0; j < m; ++j) {
for (int i = 0; i < n; ++i) {
if (image[i][j] != '0') {
lengthX++;
break;
};
}
}
int lengthY = 0;
for (int i = 0; i < n; ++i) {
for (int j = 0; j < m; ++j) {
if (image[i][j] != '0') {
lengthY++;
break;
}
}
}
return lengthX * lengthY;
}
}
```