// Package q1437 implements a solution for https://leetcode.com/problems/check-if-all-1s-are-at-least-length-k-places-away/ package q1437 func kLengthApart(nums []int, k int) bool { dist := k for _, n := range nums { if n == 0 { dist++ } else { if dist < k { return false } dist = 0 } } return true } var _ = kLengthApart