Domanda di colloquio di S&P Global

Given a tree, create a function for a getting a sub-tree given P and K.