A coin was tossed numerous times. You need to find the longest streak of tosses resulting Heads and the
longest streak of tosses resulting in Tails.
Formally, given the results of n tosses of a coin, find the maximum number of consecutive Heads and the
maximum number of consecutive Tails.
Consider the following example: a coin was tossed n = 7 times and the results were
Heads, Heads, Tails, Tails, Heads, Heads, Heads. Therefore, the longest Heads streak was 3 and the
longest Tails streak was 2.
Complete the function getMaxStreaks which takes an array of strings toss and returns an array of two integers
denoting the maximum streaks of Heads and Tails respectively.
Input Format
In the first line, there is a single integer n denoting the number of tosses.
Then, n lines follow. The ith of them contains a string toss, denoting the result of the ith toss of the coin.
Constraints
• 1n 50
• toss, e {Heads, Tails
Output Format
©c code
Answers
Answered by
2
Answer:
WTF are saying this much questions are you mad
Similar questions