Kids With the Greatest Number of Candies
Solve this the way you would in the interview: out loud, on a timer, with an AI interviewer asking follow-ups while you code. You get a scored report at the end.
Practice this as a mock interviewFree to start, no account neededProblem
There are n kids, and candies[i] is how many candies kid i has. You also hold extra_candies
spare candies.
For each kid, imagine giving that kid all of the spare candies (and nobody else anything). Return a
boolean array result where result[i] is true if kid i would then have at least as many
candies as every other kid, ties included, and false otherwise.
Examples
Constraints
- n == candies.length
- 2 <= n <= 100
- 1 <= candies[i] <= 100
- 1 <= extra_candies <= 50
What the interviewer grades
A correct solution is one of five scores. The report also grades problem understanding (did you clarify inputs and edge cases before coding), problem solving, communication while you work, code quality, and testing. See a sample report, or read up on the pattern in the lessons.