Skip to content

Commit 840642f

Browse files
committed
Create README - LeetHub
1 parent 731119b commit 840642f

File tree

1 file changed

+27
-0
lines changed
  • 1548-check-if-all-1s-are-at-least-length-k-places-away

1 file changed

+27
-0
lines changed
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<h2><a href="https://leetcode.com/problems/check-if-all-1s-are-at-least-length-k-places-away">1548. Check If All 1's Are at Least Length K Places Away</a></h2><h3>Easy</h3><hr><p>Given an binary array <code>nums</code> and an integer <code>k</code>, return <code>true</code><em> if all </em><code>1</code><em>&#39;s are at least </em><code>k</code><em> places away from each other, otherwise return </em><code>false</code>.</p>
2+
3+
<p>&nbsp;</p>
4+
<p><strong class="example">Example 1:</strong></p>
5+
<img alt="" src="https://assets.leetcode.com/uploads/2020/04/15/sample_1_1791.png" style="width: 428px; height: 181px;" />
6+
<pre>
7+
<strong>Input:</strong> nums = [1,0,0,0,1,0,0,1], k = 2
8+
<strong>Output:</strong> true
9+
<strong>Explanation:</strong> Each of the 1s are at least 2 places away from each other.
10+
</pre>
11+
12+
<p><strong class="example">Example 2:</strong></p>
13+
<img alt="" src="https://assets.leetcode.com/uploads/2020/04/15/sample_2_1791.png" style="width: 320px; height: 173px;" />
14+
<pre>
15+
<strong>Input:</strong> nums = [1,0,0,1,0,1], k = 2
16+
<strong>Output:</strong> false
17+
<strong>Explanation:</strong> The second 1 and third 1 are only one apart from each other.
18+
</pre>
19+
20+
<p>&nbsp;</p>
21+
<p><strong>Constraints:</strong></p>
22+
23+
<ul>
24+
<li><code>1 &lt;= nums.length &lt;= 10<sup>5</sup></code></li>
25+
<li><code>0 &lt;= k &lt;= nums.length</code></li>
26+
<li><code>nums[i]</code> is <code>0</code> or <code>1</code></li>
27+
</ul>

0 commit comments

Comments
 (0)