求问A题
这个思路那里有问题
public int solve(int n, int m, Point[] limit) {
int[] res = new int[23];
boolean[][] lists = new boolean[23][23];
// write code here
for (Point point : limit) {
if (point.x < point.y) {
lists[point.x][point.y] = true;
} else {
lists[point.y][point.x] = true;
}
}
for (int i = n; i >= 0; i--) {
res[i] = 1;
for (int j = i + 1; j <= n; j++) {
if (!lists[i][j]) {
res[i] += res[j];
}
}
}
return res[0];
}
vivo公司福利 368人发布
查看14道真题和解析