Goldman Sachs interview question

check whether two trees are same