Capital One interview question

Asked about trees and a greedy problem.