mirror of
https://github.com/lWolvesl/leetcode.git
synced 2026-01-13 02:38:37 +08:00
10 lines
230 B
Python
10 lines
230 B
Python
|
|
def kLengthApart(self, nums: List[int], k: int) -> bool:
|
|
last = -k-1
|
|
for i ,x in enumerate(nums):
|
|
if x != 1:
|
|
continue
|
|
if i - last <= k:
|
|
return False
|
|
last = i
|
|
return True |