[Algorithm] 20 week(5.30 ~ 6.5) 1/3

Dev_min·2022년 5월 30일
0

algorithm

목록 보기
65/157

1379. Find a Corresponding Node of a Binary Tree in a Clone of That Tree

var getTargetCopy = function(original, cloned, target) {
    if(!cloned) return;
    if (cloned.val == target.val) {
        return cloned
    }else{
        return getTargetCopy(original, cloned.left, target) || getTargetCopy(original, cloned.right, target)
    }
};
profile
TIL record

0개의 댓글