An alternative trick to solve many HLD problems using basic dfs

Nice Trick…! but how to handle updates as well?

In updates for adding nodes we can actually follow the same procedure as we are going to change only nodes with depth%1000=x and so if a new node is added it doesn’t make a difference to its ancestors(See my GPD solution).

For changing of values I am thinking of a solution and if I could get one I will update the blog.If someone else has an idea you could put it here and I will add it to the blog with your name/handle.

Amazing Trick!
Thanks for sharing