国产精品天干天干,亚洲毛片在线,日韩gay小鲜肉啪啪18禁,女同Gay自慰喷水

歡迎光臨散文網(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)論 (共 條)

分享到微博請遵守國家法律
民县| 阳信县| 德安县| 汨罗市| 栾川县| 土默特右旗| 韶关市| 黑河市| 河池市| 库伦旗| 会理县| 肥西县| 措美县| 杭锦后旗| 衡山县| 同心县| 治县。| 石柱| 霍邱县| 中山市| 区。| 营口市| 谷城县| 牟定县| 吉木萨尔县| 保康县| 林州市| 乌拉特后旗| 万荣县| 建平县| 高州市| 舟曲县| 木里| 嵩明县| 芒康县| 噶尔县| 刚察县| 志丹县| 拉萨市| 夹江县| 修武县|