FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
leetcode-study/maximum-depth-of-binary-tree/jaekwang97.java at main · DaleStudy/leetcode-study · GitHub
Uh oh!
There was an error while loading.
Please reload this page
.
DaleStudy
/
leetcode-study
Public
Uh oh!
There was an error while loading.
Please reload this page
.
Notifications
You must be signed in to change notification settings
Fork
361
Star
155
Code
Issues
75
Pull requests
5
Discussions
Actions
Projects
Wiki
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Discussions
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
leetcode-study
/
maximum-depth-of-binary-tree
/
jaekwang97.java
Copy path
More file actions
More file actions
Latest commit
History
History
History
25 lines (19 loc) · 432 Bytes
Breadcrumbs
leetcode-study
/
maximum-depth-of-binary-tree
/
jaekwang97.java
Copy path
File metadata and controls
25 lines (19 loc) · 432 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
class
Solution
{
private
int
max
;
public
int
maxDepth
(
TreeNode
root
) {
if
(
root
==
null
) {
return
0
;
}
max
=
0
;
dfs
(
root
,
1
);
return
max
;
}
private
void
dfs
(
TreeNode
node
,
int
depth
) {
if
(
node
==
null
) {
return
;
}
max
=
Math
.
max
(
max
,
depth
);
dfs
(
node
.
left
,
depth
+
1
);
dfs
(
node
.
right
,
depth
+
1
);
}
}
Back
|
FazBrowse Home
|
New Git URL