Amazon interview question

TopK Frequent elements, Maximum path sum in a tree