Nested Ternaries
Instead of something like the following
if (val > root.val) {
return contains(root.right, val)
} else if (val < root.val) {
return contains(root.left, val)
} else {
return true
}
This is a shortened version. Make sure to follow this format to make it more easily readable
(val > root.val)
? contains(root.right, val)
: (val < root.val)
? contains(root.left, val)
: true