gOOgle - L4 _ Screen Round
Anonymous User
2542

Had screening round yesterday. Cant remember the exact question but it was someting along these lines.

You're building a streaming payment validator that receives a number as a digit-by-digit string. At every step, you need to check if the current prefix forms a number divisible by a given integer m.

Return an array div such that div[i] = 1 if the prefix from word[0..i] is divisible by m, else 0.
You cant store the numbers as they can be very large
Brute force is obvious but interviewer was not ammused, can anyone provide O(n) solution

Comments (14)