This file is to keep track of all mistakes made in my code/problem solving.
Remember that some strings have spaces in them. Upper case, lower case.
def inorder(self, root): if root is not None: for val in self.inorder(root.left): yield val yield root.val for val in self.inorder(root.right): yield val
It is often a good idea to use a generator as a generator will yield a more elegant solution. We can use iteration instead of recursion. (Problem: Range sum of BST)
Think first about the right representation. If dfs traversal is needed, NEVER use matrix representation unless its searching 1 row/col away
In matrix dfs, REMEMBER to check bounds
Reversing singly linked list
When implementing skipping, must use the .next instead of the node itself.
if not reg and not string: return True if not reg return False if not reg: return not String