LeetCode Solutions/LeetCoding Challenge/January 2020 LeetCoding Challenge/Check If All 1's Are at Least Length K Places Away.java
<reponame>DevashishPathrabe/LeetCodeclass Solution {
    public boolean kLengthApart(int[] nums, int k) {
        for(int i=0, count=0; i<nums.length; i++){
            if(nums[i] == 1 && count < k && i != 0){
                return false;
            }
            else if(nums[i] == 1){
                count = 0;
            } else{
                count++;
            }
        }
        return true;
    }
}