Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit90b7bf3

Browse files
refactor 1379
1 parent5970bc2 commit90b7bf3

File tree

1 file changed

+0
-36
lines changed

1 file changed

+0
-36
lines changed

‎src/main/java/com/fishercoder/solutions/_1379.java

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -2,42 +2,6 @@
22

33
importcom.fishercoder.common.classes.TreeNode;
44

5-
/**
6-
* 1379. Find a Corresponding Node of a Binary Tree in a Clone of That Tree
7-
*
8-
* Given two binary trees original and cloned and given a reference to a node target in the original tree.
9-
* The cloned tree is a copy of the original tree.
10-
* Return a reference to the same node in the cloned tree.
11-
* Note that you are not allowed to change any of the two trees or the target node and the answer must be a reference to a node in the cloned tree.
12-
*
13-
* Follow up: Solve the problem if repeated values on the tree are allowed.
14-
*
15-
* Example 1:
16-
* Input: tree = [7,4,3,null,null,6,19], target = 3
17-
* Output: 3
18-
* Explanation: In all examples the original and cloned trees are shown. The target node is a green node from the original tree. The answer is the yellow node from the cloned tree.
19-
*
20-
* Example 2:
21-
* Input: tree = [7], target = 7
22-
* Output: 7
23-
*
24-
* Example 3:
25-
* Input: tree = [8,null,6,null,5,null,4,null,3,null,2,null,1], target = 4
26-
* Output: 4
27-
*
28-
* Example 4:
29-
* Input: tree = [1,2,3,4,5,6,7,8,9,10], target = 5
30-
* Output: 5
31-
*
32-
* Example 5:
33-
* Input: tree = [1,2,null,3], target = 2
34-
* Output: 2
35-
*
36-
* Constraints:
37-
* The number of nodes in the tree is in the range [1, 10^4].
38-
* The values of the nodes of the tree are unique.
39-
* target node is a node from the original tree and is not null.
40-
* */
415
publicclass_1379 {
426
publicstaticclassSolution1 {
437
publicfinalTreeNodegetTargetCopy(finalTreeNodeoriginal,finalTreeNodecloned,finalTreeNodetarget) {

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp