Hot answers tagged

2

The basic idea in your algorithm is correct (it will result in an optimal algorithm if you implement it correctly) Hpwever the details are missing. For example, how can one compute the height of the nodes using DFS? Another important detail is the "mapping" you talked about. How exactly do you store this mapping? The regular approach of using a ...


Only top voted, non community-wiki answers of a minimum length are eligible