Print all nodes at k distance from the root in a binary tree iteratively
I think it's a decent implementation. It is readable and understandable. Nonetheless, I have some tips:


Try to avoid single letter variable names, like d (unless in very specific cases like certain loop variables or mathematical constructs).
Personally not a fan of new lines after each opening brace, it breaks the flow for me.
Try to always use braces with if\while\... statements. It helps to prevent potential bugs.
You could instead of silently returning, throw an (IllegalArgument\Nullpointer)Exception when passed node is null. Fail fast! Same with negative depths passed.
Trivia: how would you print the root with your implementation?


I also do not think you need the marker. If you instead each loop execution only take all nodes present in the queue at the start of that loop, you will process all nodes level by level (but only use it if you have constant time size operations). As an example:

public static void print(Node root, int depth) {
    if (root == null) {
        return;
    }

    Deque&lt;Node&gt; queue = new ArrayDeque&lt;&gt;();
    queue.offer(root);

    while (!queue.isEmpty()) {
        boolean atRequiredDepth = --depth == 0;
        int nodeCount = queue.size();

        if (atRequiredDepth) {
            for (int i = 0; i &lt; nodeCount; i++) {
                Node node = queue.poll();
                System.out.println(node.val);
            }
            return;
        } else {
            for (int i = 0; i &lt; nodeCount; i++) {
                Node node = queue.poll();
                if (node.left != null) {
                    queue.offer(node.left);
                }
                if (node.right != null) {
                    queue.offer(node.right);
                }
            }
        }
    }
}