Mark_Stark1's blog

By Mark_Stark1, history, 4 years ago, In English

I tried solving the diameter of a tree (not necessarily a binary tree) problem in python 3.0. I created a adjacency list and ran dfs on the tree storing the maximum two heights of the sub-tree and the maximum diameter encountered so far. I think my logic is pretty correct, but I can't seem to find a problem with the code. It gave a memory limit exceeded error in PyPy and a runtime error in python. Problem:https://codeforces.me/gym/102694/problem/A My Solution:91533595

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