How to solve binary tree path-related problems - Inside code