Your Dashboard
Interview Coaching
Learn
System Design
ML System Design
Code
Behavioral
Salary Negotiation
Interview Guides
Search
⌘K
Get Premium
Leetcode 957. Prison Cells After N Days
Given an 8-cell binary row updated daily where each interior cell becomes 1 iff its two neighbors are equal (edge cells become 0), return the state after n days. Because cells.length is fixed (8) and n can be up to 1e9, the solution relies on detecting and fast-forwarding through the repeating cycle of states.
Question Timeline
See when this question was last asked and where, including any notes left by other candidates.
All Regions
Comments
Hello Interview Premium
Your account is free and you can post anonymously if you choose.