Cadence Design Systems interview question

Write a dynamic algorithm to find the height of a tree