Help Count nodes

I need to count the nodes of a tree implemented as follows:
sealed trait[+A]
case class LeafA extends Tree[A]
case class Branch[A](left: Tree[A], rigth: Tree[A]) extends Tree[A]

What’s the signature of the method you’d like to implement? What have you tried so far?

With a DFS travesal, in a recursive way. For each Branch, if left is a Leaf, that is the “path” end, so try the right with the same “Node Count”. In other case (it sound like pattern matching :stuck_out_tongue_winking_eye:), add another node to the count and repeat.