0
/ 10
Description
Recursive procedure that returns the number of H in a string of heads (H) or tails (T) outcomes. This must be a recursive...
Recursive procedure that returns the number of
H in a string of heads (H) or tails (T) outcomes.
This must be a recursive routine. You can assume
that the argument str has only H and T in uppercase.
You may consult the Java documentation on String for methods to use.
Examples:
countFlipCoin("HT") -> 1
countFlipCoin("HTH") -> 2
countFlipCoin("THTH") -> 2
Your feedback will appear here when you check your answer.