32. Longest Valid Parentheses
Medium
Given a string containing just the characters '('
and ')'
, return the length of the longest valid (well-formed) parentheses
substring.
Example 1:
Example 2:
Example 3:
Constraints:
0 <= s.length <= 3 * 104
s[i]
is'('
, or')'
.
解題
這隻影片中的第三種解法,使用 stack。
Runtime: 0 ms, faster than 100%
Memory Usage: 3.5 MB, less than 26.84%
Previous28. Find the Index of the First Occurrence in a StringNext33. Search in Rotated Sorted Array
Last updated