title: find whether all the leaf nodes are at the same height
body: <p>I have a Adjacency list in the form of Dictionary like this in Python:
      <code>{1:[2,3], 2:[4,5,6], 3:[7,8]}</code> 
     My findleaf() looks something like this</p>
  
  <pre><code>def findleaf(d):
       keylist= list(d.keys()) 
       leaf = []
       for i in d:
           valList = d[i]
           for j in valList:
              if j not in keylist:
                 leaf.append(j)
       return leaf
  </code></pre>
  
  <p>So the above methods returns the leaves as [4,5,6,7,8] but i also want to know whether they are on the same level.</p>
  
  <p>The first thing that comes to mind is to find path from start node to leaf node and then find its length.
  But can we do it better or even in the same above mentioned function where we return leaf along with their heights.</p>