← 返回 amazon 的题目列表Valid Mathematical Expression
类型:online_judge
Write a program to determine if a given string is a valid mathematical expression. The input string may contain digits from zero to nine, arithmetic operators (+,-,*,/), and various types of brackets (curly, square, round). The expression must have matching brackets and correct use of operators. Support operator precedence and nested levels.
Example Input:
([]{5+4*{2-3}/2})
Example Output:
True
Constraints:
The string length is between 1 and 10000.
Ensure operators and brackets are fully matched and form a valid math expression.
All numbers are single-character (0-9).
Example
Input
([]{5+4*{2-3}/2})