Erica and Bob participate in a friendly Hackathon that allows each to solve one question a day out of the three offered. There will be
Erica and Bob participate in a friendly Hackathon that allows each to solve one question a day out of the three offered. There will be one easy, one medium and one hard question, with points awarded based on difficulty. The participant can also choose to skip a question. The winner is the one with the highest score at the end of the competition based on the following scale. In case of a tie, the person who solves the most hard problems wins. If it's the same, the one with more medium problems wins; otherwise, the one with more easy problems wins. If they both have the same score and the same number of problems at the same difficulty level, then it's a tie.
You will be given two strings with each character of the strings indicating the difficulty of the problem solved on day f iJ of the Hackathon by a coder. You are to calculate the scores for Erica and Bob and then return the name of the winner: Erica, Bob or if they tie: Tie. Function Description
Complete the function winner in the editor below. The function must return the name of the winner Erica or Bob, or lie if their scores are equal and they've done the same number of problems at each difficulty level.
Winner has the following parameter(s):
Erica: an string where erica(iJ denotes the difficulty of the problem she solved on day i
Bob: an string where bobrn denotes the difficulty of the problem he solved on day i
Difficulty Skip (S) Easy (E) Medium (M) Hard (H) Scoring Table Points 0 1 3 5
Step by Step Solution
3.47 Rating (160 Votes )
There are 3 Steps involved in it
Step: 1
EricaEcount O EricaMcountO EricaHcountO BobEcount0 BobMcountO Bob H countO enca input String of ques...See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started