This commit is contained in:
2025-11-17 17:45:06 +08:00
parent f5ce056f2d
commit 2971e19529
4 changed files with 66 additions and 0 deletions

15
25/11/1437.java Normal file
View File

@@ -0,0 +1,15 @@
class Solution {
public boolean kLengthApart(int[] nums, int k) {
int last = -k - 1;
for (int i = 0; i < nums.length; i++) {
if (nums[i] != 1) {
continue;
}
if (i - last <= k) {
return false;
}
last = i;
}
return true;
}
}