Pergunta de entrevista da empresa Tibra

You have a tree with each level being 1, 2, 3... elements large. Each element has a value. Each parent has two children. Find the largest path down?

Resposta da entrevista

Sigiloso

14 de jul. de 2024

I recall you might want to use dp. At a node, look at the best subproblem from its two children and add to that. Remember that its children may have already been solved for before so thats where dp comes in. Also for python, I needed to set the recursion limit to like 1003, since one of the tests goes through 1000 levels (but this meant there were 10003 calls in the stack) and I had no other ideas.

1