Solve Simple Tree Counting

Answer counting queries involving a tree. Solving code challenges on HackerRank is one of the best ways to prepare for programming interviews.