implemented a hasSum method that checks if there is a path from root to a leaf which values sum up to the provided value