Sophos interview question

Write program for finding depth of tree