Created
August 4, 2021 22:42
-
-
Save cjnghn/4850bcfdd1af9b3a512dd10ce8b99d14 to your computer and use it in GitHub Desktop.
트 리 기 본
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 트리 높이 = 서브트리들 중 가장 큰 높이 + 1 (루트 포함) | |
int getHeight(int root) { | |
int res = 1; | |
for (int child: children[root]) | |
result = max(result, getHeight(child) + 1); | |
return result; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment