Go row by row to the row at depth d-1, then insert the new nodes there.

```
def addOneRow(self, root, v, d):
dummy, dummy.left = TreeNode(None), root
row = [dummy]
for _ in range(d - 1):
row = [kid for node in row for kid in (node.left, node.right) if kid]
for node in row:
node.left, node.left.left = TreeNode(v), node.left
node.right, node.right.right = TreeNode(v), node.right
return dummy.left
```