Check If All 1's Are at Least Length K Places Away
Last updated
Last updated
Given an array nums
of 0s and 1s and an integer k
, return True
if all 1's are at least k
places away from each other, otherwise return False
.
Example 1:
Example 2:
Example 3:
Example 4:
Constraints:
1 <= nums.length <= 10^5
0 <= k <= nums.length
nums[i]
is 0
or 1