Amazon Interview Question

valid brackets on leetcode and we dove a bit deeper