Amazon Interview Question

Programming question - check if string has balanced brackets, firstly with "()" only and thereafter adding all other brackets such as "[]{}<>".

Interview Answers

Anonymous

Jun 2, 2022

this is valid parenthesis on leetcode

7

Anonymous

Feb 4, 2023

Use a stack and push opening parentheses into stack and pop when u get a closing one and at last check if the stack is empty if yes its balanced else not.

Anonymous

Aug 28, 2022

Use hashmap to identify the open parentheses to close parentheses

1