Created
July 10, 2021 16:59
-
-
Save wohhie/adcc571c22e44ba18a24b69d0a93912e to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| private int count_who_have_both_children(Node node){ | |
| int x, y; | |
| if (node != null){ | |
| x = count_who_have_both_children(node.left); | |
| y = count_who_have_both_children(node.right); | |
| if (node.left != null && node.right != null){ | |
| return x + y + 1; | |
| }else { | |
| return x + y; | |
| } | |
| } | |
| return 0; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment