give root binary tree integer val depth add row node value val give depth depthnote root node depth 1the add rule isgiven integer depth null tree node cur depth depth 1 create tree node value val cur leave subtree root right subtree rootcur original left subtree leave subtree new left subtree rootcur original right subtree right subtree new right subtree rootIf depth 1 mean depth depth 1 create tree node value val new root original tree original tree new root leave subtree Example 1input root 426315 val 1 depth 2output 4112nullnull6315example 2input root 42null31 val 1 depth 3output 42null113nullnull1 ConstraintsThe number nod tree range 1 104the depth tree range 1 104100 Nodeval 100105 val 1051 depth depth tree 1