![](https://img-blog.csdnimg.cn/20201014180756738.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
LeetCode
radsyy
这个作者很懒,什么都没留下…
展开
-
Two Sum
Two Sum 问题描叙:给定一个整数数组nums和一个整数target,返回数组中两个数之和为该target的数组序号。 Example: Given nums = [2, 7, 11, 15], target = 9, Because nums[0] + nums[1] = 2 + 7 = 9, return [0, 1]. 思路:存储数组中每个数与target的差。每次存储新差值原创 2018-01-14 10:10:31 · 110 阅读 · 0 评论 -
Valid Parentheses
问题描叙:给定一个字符串s包含'(',')','[',']','{','}'。判断这串字符串括号能否匹配。 Example: Given s = "[({})}", return false. 思路:使用栈来处理括号的匹配,如果是左边的符号,则入栈;否则,判断当前右符号是否与栈顶元素相配对。若能配对,则出栈,然后考察下一个符号;否则,返回false。所有符号考察完之后,如果栈为空返回t原创 2018-01-14 10:59:06 · 85 阅读 · 0 评论