stack

[LeetCode] Valid Parentheses

Problem Given a string containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid. The brackets must close in the correct order, "()" and "()[]{

Basic Calculator

题目:实现一个计算器的基本功能,整数的加减乘除操作。遵循运算符优先次序,但是不要求加括号。分析:(1)使用Stack存储数据,这样做的好处是在乘除操作的时候可以取出最近存进的整数,乘除操作完再把结果压进Stack;(2)字符串处理的时候使用Character.isDigit()方法来判断,这里容易犯错的是,操作符的判断比数字判断先出现,但是在压站的时候会先压数字,所以操作符

[LintCode] Epression Tree Build

ProblemThe structure of Expression Tree is a binary tree to evaluate certain expressions.All leaves of the Expression Tree have an number string value. All non-leaves of the Expression Tre