X1233: Flip Coin

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.

Examples:

countFlipCoin("HT") -> 1
countFlipCoin("HTH") -> 2
countFlipCoin("THTH") -> 2

Your Answer:

Reset

Practice a different Java exercise

Feedback

Your feedback will appear here when you check your answer.