You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<h2><ahref="https://leetcode.com/problems/1-bit-and-2-bit-characters">717. 1-bit and 2-bit Characters</a></h2><h3>Easy</h3><hr><p>We have two special characters:</p>
2
+
3
+
<ul>
4
+
<li>The first character can be represented by one bit <code>0</code>.</li>
5
+
<li>The second character can be represented by two bits (<code>10</code> or <code>11</code>).</li>
6
+
</ul>
7
+
8
+
<p>Given a binary array <code>bits</code> that ends with <code>0</code>, return <code>true</code> if the last character must be a one-bit character.</p>
9
+
10
+
<p> </p>
11
+
<p><strongclass="example">Example 1:</strong></p>
12
+
13
+
<pre>
14
+
<strong>Input:</strong> bits = [1,0,0]
15
+
<strong>Output:</strong> true
16
+
<strong>Explanation:</strong> The only way to decode it is two-bit character and one-bit character.
17
+
So the last character is one-bit character.
18
+
</pre>
19
+
20
+
<p><strongclass="example">Example 2:</strong></p>
21
+
22
+
<pre>
23
+
<strong>Input:</strong> bits = [1,1,1,0]
24
+
<strong>Output:</strong> false
25
+
<strong>Explanation:</strong> The only way to decode it is two-bit character and two-bit character.
0 commit comments