TreeNode getParentOfDeepNodes(Set<TreeNode> set, TreeNode x) {
        Queue<TreeNode> q = new LinkedList<>();
        q.add(x);
        TreeNode r = x;
        while (!q.isEmpty()) {
            TreeNode current = q.remove();
            if (!isParent(current, new HashSet<>(set))) {
                continue;
            }
            r = current;
            if (current.left != null)
                q.add(current.left);
            if (current.right != null)
                q.add(current.right);
        }
        return r;
    }
Why Did you create this class? what does it do?
src/problems/medium/SmallestSubtreewithalltheDeepestNodes.java