Beautiful code is its own reason for being

Sometimes you come across a beautiful piece of code that makes your heart sing and spark with joy. So creating this post bcoz beautiful code is its own reason for being !

References

1. Video - Maximum Binary Tree Solution

2. Maximum Binary Tree Problem

3. Wiki - Cartesian Tree