Tap here to switch tabs
Problem
Submissions

Problem: Check If All 1's Are at Least Length K Places Away

med
30 min
Try to solve the Check If All 1's Are at Least Length K Places Away problem.

Statement

Given a binary array nums and an integer k, return true if all 11’s are separated by at least k places from each other, or false otherwise.

Constraints:

  • 1≤1 \leq nums.length ≤105\leq 10^5

  • 0≤0 \leq k ≤\leq nums.length

  • nums[i] is either 00 or 11

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Check If All 1's Are at Least Length K Places Away

med
30 min
Try to solve the Check If All 1's Are at Least Length K Places Away problem.

Statement

Given a binary array nums and an integer k, return true if all 11’s are separated by at least k places from each other, or false otherwise.

Constraints:

  • 1≤1 \leq nums.length ≤105\leq 10^5

  • 0≤0 \leq k ≤\leq nums.length

  • nums[i] is either 00 or 11