← JPMorgan Chase Interview Insights
Start by analyzing small N to identify patterns, then derive a recurrence relation by considering the placement of the first domino. Solve the recurrence to get a closed-form or efficient computation, and generalize for any N.
Pro tip: Mention that the recurrence can be computed in O(N) time with O(1) space, and note that for large N, the count grows exponentially, so modulo arithmetic may be needed in practice.
Compute the number of tilings for N=0,1,2,3,4 manually to identify initial values and patterns.
Consider the leftmost column: either place a vertical domino (reducing to N-1) or two horizontal dominoes (reducing to N-2). This gives f(N) = f(N-1) + 2*f(N-2) for N>=2, with f(0)=1, f(1)=0.
Solve the characteristic equation r^2 = r + 2, giving roots r=2 and r=-1. Use initial conditions to find constants, yielding f(N) = (2^N + 2*(-1)^N)/3 for even N, and 0 for odd N.
State the closed-form for any N, and discuss time/space complexity of computing it iteratively. Mention that for odd N, the answer is 0.
AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.