题解:
- 数据范围小,直接暴力
- 双指针
public boolean canChoose(int[][] groups, int[] nums) {
int n = groups.length;
int length = nums.length;
int j = 0;
int k = 0;
for (int i = 0; i < length && j < n; i++) {
if (nums[i] == groups[j][k]) {
k++;
} else {
i = i - k;
k = 0;
}
if (k >= groups[j].length) {
k = 0;
j++;
}
}
return j == n;
}
标签:数组,nums,int,++,length,groups,连接,1764
From: https://www.cnblogs.com/eiffelzero/p/16989334.html