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.net/gym/102694/problem/A My Solution:91533595