Given a string s containing just the characters (, ), {, }, [ and ], determine if the input string is valid.
Input: s = "()"
Output: true
Topics: stack
Asked by: Amazon, Google, Meta, Microsoft, Bloomberg, Adobe
Time complexity: O(n). Space complexity: O(n).