Here I add operators
== to the
TreeNode class. Mainly for fun and learning how to do Ruby's monkey patching.
class TreeNode def ==(other) !self ? !other : !!other && self.val == other.val && self.left == other.left && self.right == other.right end def <=(other) self == other || !!other && (self <= other.left || self <= other.right) end end def is_subtree(s, t) t <= s end