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>525. Contiguous Array</h2><h3>Medium</h3><hr><div><p>Given a binary array, find the maximum length of a contiguous subarray with equal number of 0 and 1. </p>
2
+
3
+
4
+
<p><b>Example 1:</b><br>
5
+
</p><pre><b>Input:</b> [0,1]
6
+
<b>Output:</b> 2
7
+
<b>Explanation:</b> [0, 1] is the longest contiguous subarray with equal number of 0 and 1.
8
+
</pre>
9
+
<p></p>
10
+
11
+
<p><b>Example 2:</b><br>
12
+
</p><pre><b>Input:</b> [0,1,0]
13
+
<b>Output:</b> 2
14
+
<b>Explanation:</b> [0, 1] (or [1, 0]) is a longest contiguous subarray with equal number of 0 and 1.
15
+
</pre>
16
+
<p></p>
17
+
18
+
<p><b>Note:</b>
19
+
The length of the given binary array will not exceed 50,000.
0 commit comments