2018年9月8日

20.Valid Parentheses (python)

摘要: 这道题主要用栈来实现的。什么是栈呢,参照书上的后缀表达式的例子谈谈自己的理解,栈最明显的特征是先进后出。所以可以有效的结合题目中 ()对匹配问题,可以把从列表中获取的符号先存到栈中。 首先建个空列表用于映射栈中元素。然后挨个查询传递过来的列表的每个元素,不在栈中就压进栈,在的话再看看是不是栈顶元素。 阅读全文

posted @ 2018-09-08 23:14 shaer 阅读(180) 评论(0) 推荐(0) 编辑

1.the sum (python)

摘要: Given an array of integers, return indices of the two numbers such that they add up to a specific target. You may assume that each input would have ex 阅读全文

posted @ 2018-09-08 20:44 shaer 阅读(220) 评论(0) 推荐(0) 编辑

导航