This solution runs 19ms and beats 100% in Java submission with 63 test cases. But it is not in DP, so I am wonder whether it is correct if more corner test cases are added. Need help !!!

```
public int findMaxForm(String[] strs, int m, int n) {
Arrays.sort(strs, new Comparator<String>(){
public int compare(String s1, String s2) {
int val = s1.length() - s2.length();
if(val != 0)
return val;
return s1.compareTo(s2);
}
});
int result = 0;
for(int i = 0; i < strs.length; i++)
result = Math.max(result, dfs(strs, m, n, i));
return result;
}
public int dfs(String[] strs, int m, int n, int start) {
boolean flag;
int result = 0, mm, nn;
for(; start < strs.length; start++) {
char[] c = strs[start].toCharArray();
flag = true;
if(c.length > m + n)
break;
mm = m;
nn = n;
for(int i = 0; i < c.length; i++) {
if(c[i] == '0' && m > 0)
m--;
else if(c[i] == '1' && n > 0)
n--;
else {
flag = false;
break;
}
}
if(flag)
result++;
else {
m = mm;
n = nn;
}
}
return result;
}
```