Practice

Contest

CAKEWALK

Prerequisites:

Loops, Conditional statements

Problem:

You are given the results of each contestant for 5 problems, either 1 or 0 - which means the contestant has solved it or not correspondingly, and wants you to find his/her level(“Beginner”, “Junior Developer”, “Middle Developer”,“Senior Developer”,“Hacker”, or Jeff Dean).

Explanation:

It is just a straight-forward problem. The solution is to sum the results for each row and output the corresponding skill given in the problem statement using " if " conditions. Preferably you may use " switch - case " to make your code seem elegant.

O(N)

Space Complexity:

O(N) or O(1)

1 Like
``````Preferably you may use " switch - case " to make your code seem elegant. :)
``````

And probably forget break statement after some case and get WA .

But honestly though, I used switch case cause, HELL YEAH! Elegant! However, the constant fear of missing break statement or getting compile time error was dreading over me XD. We dont get many questions where we can elegantly apply switch case instead of if else checking for equality.

Neither if-else nor switch-case
https://www.codechef.com/viewsolution/17470455