AI Interview Prep is optimized for larger screens
Please open this on a laptop or desktop (1024px and wider) to use the full editor, whiteboard, and AI coaching surface.
Understand the problem
Restate the problem precisely. Interviewers reward candidates who pause, define the contract, and name the guarantees before coding.
There are `n` children standing in a line. Each child is assigned a rating value given in the integer array `ratings`. You are giving candies to these children subjected to the following requirements: each child must have at least one candy, and children with a higher rating get more candies than their neighbors. Return the minimum number of candies you need to have to distribute the candies to the children.
Once you've drafted a response, click Submit for AI review and a senior engineer will critique your reasoning.