韩先超K8S+DevOps云原生全栈技术:基于世界500强的高薪实战Kubernetes课程
class Solution {
public TreeNode addOneRow(TreeNode root, int val, int depth) {
if (root == null) return null;
if (depth == 1) return new TreeNode(val, root, null);
if (depth == 2) {
root.left = new TreeNode(val, root.left, null);
root.right = new TreeNode(val, null, root.right);
} else {
addOneRow(root.left, val, depth - 1);
addOneRow(root.right, val, depth - 1);
}
return root;
}

