My LeetCode grinding. Trying to do a problem a day.
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

problem.txt 423B

123456789101112131415
  1. Given a binary array, find the maximum length of a contiguous subarray with equal number of 0 and 1.
  2. Example 1:
  3. Input: [0,1]
  4. Output: 2
  5. Explanation: [0, 1] is the longest contiguous subarray with equal number of 0 and 1.
  6. Example 2:
  7. Input: [0,1,0]
  8. Output: 2
  9. Explanation: [0, 1] (or [1, 0]) is a longest contiguous subarray with equal number of 0 and 1.
  10. Note: The length of the given binary array will not exceed 50,000.