Binary Prefix Divisible By 5
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
You are given an array nums of bits (each 0 or 1). For every index i, let x_i be the
integer whose binary representation is nums[0..i], with nums[0] as the most significant bit.
Return a boolean array answer of the same length where answer[i] is true exactly when x_i is
divisible by 5.
The prefixes grow to thousands of bits, so avoid building the full numbers.
Examples
Constraints
- 1 <= nums.length <= 10^5
- nums[i] is either 0 or 1
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.