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

Check If All 1's Are at Least Length K Places Away Problem — ExecCode Easy DSA Practice

Solve the Check If All 1's Are at Least Length K Places Away problem on ExecCode. Free online easy DSA practice in Arrays - Logic Building. Write and run code in Java, C++, Python — no signup required to run.

Description Given an binary array nums and an integer k, return true if all 1 's are at least k places away from each other, otherwise return false. Examples Example 1 Input: nums = [1,0,0,0,1,0,0,1], k = 2 Output: true Explanation: Each of the 1s are at least 2 places away from…

Practice Check If All 1's Are at Least Length K Places Away free on ExecCode. Browse more ExecCode DSA problems.