void dfs(TreeNode x, List<Integer> list) {
        if (x == null)
            return;
        if (x.left == null && x.right == null) {
            list.add(x.val);
            return;
        }
        dfs(x.left, list);
        dfs(x.right, list);
    }
Why Did you create this class? what does it do?
src/problems/easy/LeafSimilarTrees.java