and i did that at last! spoj: longest path in a tree | PT07Z

It is solved using BFS. the tricky part is with the second traversal in which we have to keep a count.

Advertisements

One thought on “and i did that at last! spoj: longest path in a tree | PT07Z

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s