salt_n_ice's blog

By salt_n_ice, history, 2 months ago, In English

Problem : Link. I simply did bfs from node 1 and found the maximum distance from this node to all other nodes

Code

So the solution is O(n+m) but still, there is TLE in one case. Why?

 
 
 
 
  • Vote: I like it
  • -2
  • Vote: I do not like it