Question: Professor Arena is planning to reward his algorithm students for surviving the first exam in CS 3 2 5 0 . One idea he has
Professor Arena is planning to reward his algorithm students for surviving the first exam in CS One idea he has is to distribute snack bags eg Lays Potato Chips, Pretzels, Doritos, Cheetos, etc. at the lecture following the exam. Unbeknownst to many, Prof. Arena is a bit underpaid and underfunded. Consequently, he must devise a reward system so that he is using his money wisely. After consulting his collegeage daughter, Mia, for some advice, he arrives at the following gameplan:
All students who took the exam must receive at least one snack bag, even if they performed poorly.
Every student should receive more snack bags than any student to their immediate left or right if they scored higher than that student. Similarly, if a student scored lower than a student to their immediate left or right, they must receive fewer snack bags than their neighbor, who scored higher.
You are provided as input a paired list of exam scores and student names in an array corresponding to the order in which students are seated you can imagine this as one big, long row of students You may further assume that all scores are unique ie no two students received the same score on the exam
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
