Kotlinlearncs.online LogoJava
Return to List

Solve: BinaryTree Odd Sum

Created By: Geoffrey Challen
/ Version: 2021.4.0

Create a method named oddSum that accepts a BinaryTree<Int>?, that is a BinaryTree containing Int values. Return the sum of all the odd values in the tree. As a reminder, value % 2 returns a non-zero value if value is odd.

For reference, cs125.trees.BinaryTree is defined like this:

Related Lessons

Stuck? You may find these lessons helpful: