summaryrefslogtreecommitdiff
path: root/2020
diff options
context:
space:
mode:
authormo khan <mo.khan@gmail.com>2020-08-13 13:14:40 -0600
committermo khan <mo.khan@gmail.com>2020-08-13 13:14:40 -0600
commit13d551ee59e742d177224d551c3d2df470d4675a (patch)
treeda46b946eed1cc3cf9a4a1470be536c49c3ba4f3 /2020
parent8b8289e5cca33e72273119c8d302594237214882 (diff)
Add daily problem
Diffstat (limited to '2020')
-rw-r--r--2020/08/13/README.md37
1 files changed, 37 insertions, 0 deletions
diff --git a/2020/08/13/README.md b/2020/08/13/README.md
new file mode 100644
index 0000000..6b1a77a
--- /dev/null
+++ b/2020/08/13/README.md
@@ -0,0 +1,37 @@
+Image you are buliding a compiler.
+Before running any code, the compiler must check
+that the parentheses in the program are balanced.
+
+Every opening bracket must have a corresponding closing bracket.
+We can approximate this using strings.
+
+Given a string containing just the characters '(', ')', '{', '}', '[' and ']',
+determine if the input string is valid.
+
+An input string is valid if:
+
+* open brackets are closed by the same type of brackets.
+* open brackets are closed in the correct order.
+* Note that an empty string is also considered valid.
+
+Example:
+
+Input: "((()))"
+Output: True
+
+Input: "[()]{}"
+Output: True
+
+Input: "({[)]"
+Output: False
+
+
+```python
+class Solution:
+ def isValid(self, s):
+ # TODO::
+
+assert False, Solution.isValid("()(){(())")
+assert True, Solution.isValid("")
+assert True, Solution.isValid("([{}])()")
+```