五月天青色头像情侣网名,国产亚洲av片在线观看18女人,黑人巨茎大战俄罗斯美女,扒下她的小内裤打屁股

歡迎光臨散文網(wǎng) 會(huì)員登陸 & 注冊

Leetcode 20. Valid Parentheses

2023-03-01 10:02 作者:您是打尖兒還是住店呢  | 我要投稿

Given a string?s?containing just the characters?'(',?')',?'{',?'}',?'['?and?']', determine if the input string is valid.

An input string is valid if:

  1. Open brackets must be closed by the same type of brackets.

  2. Open brackets must be closed in the correct order.

  3. Every close bracket has a corresponding open bracket of the same type.

?

Example 1:

Input: s = "()"Output: true

Example 2:

Input: s = "()[]{}"Output: true

Example 3:

Input: s = "(]"Output: false

?

Constraints:

  • 1 <= s.length <= 104

  • s?consists of parentheses only?'()[]{}'.

easy 題目,其實(shí)用stack來做,速度會(huì)提高很多的。





Runtime:?186 ms, faster than?5.93%?of?Java?online submissions for?Valid Parentheses.

Memory Usage:?42.9 MB, less than?5.76%?of?Java?online submissions for?Valid Parentheses.


Leetcode 20. Valid Parentheses的評(píng)論 (共 條)

分享到微博請遵守國家法律
洪雅县| 佛冈县| 响水县| 南木林县| 德格县| 杭锦旗| 龙井市| 葫芦岛市| 黄平县| 安西县| 咸宁市| 兴宁市| 靖边县| 梁山县| 舒城县| 汝城县| 资兴市| 武义县| 江孜县| 黎平县| 商城县| 光泽县| 高密市| 丰县| 淅川县| 津南区| 克东县| 壶关县| 思茅市| 奉新县| 黑水县| 察哈| 文成县| 曲靖市| 茂名市| 高陵县| 英吉沙县| 乐陵市| 涪陵区| 乐至县| 榆林市|