Pergunta de entrevista da empresa Capital One

Asked about trees and a greedy problem.