Soal
00:00

30. Longest Valid Parentheses

SulitStackAmazonGoogle

Given a string containing only parentheses, return the length of the longest valid parentheses substring.

Contoh 1:

Input: s = "(()"
Output: 2

Contoh 2:

Input: s = ")()())"
Output: 4

Batasan:

  • 0 <= s.length <= 3 * 10^4
Mode kode inti
● Tersimpan otomatisBaris 1, kolom 1