Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Let's say that we have a contest the details of which we don't care about apart from one simple rule. If a contestant earns a
Let's say that we have a contest the details of which we don't care about apart from one simple rule. "If a contestant earns a score equal to or greater than the k-th place finisher, they will advance to the next round if their own score is greater than 0". So write functionnextRound(k,scores)which will count how many contestants will progress to the next round. There will be no more than 20 contestants, and 1 <= k <= 20. The scores will be given in an order, but contestants can have the same score.
For example:
TestResultprint(nextRound(5,[10,9,8,7,6,6,6,5,4])) 7 print(nextRound(2,[0,0,0,0])) 0
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
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