Hiring process8 levels
  1. 1 IQ Test
  2. 2 Additional Online Test (If Required)
  3. 3 Office Interview with Hiring Manager
  4. 4 Unpaid Test Task (Motivation Check)
  5. 5 Paid Test Task and Follow-Up Interview
  6. 6 Iterative Paid Test Tasks
  7. 7 Office Verification
  8. 8 Final Interview with the Founder

Problems > Fibonacci, Astronomically > Editorial

Fibonacci, Astronomically — Solution & Editorial

Back to the Problem

Fast doubling: F(2k) = F(k)[2F(k+1)−F(k)] and F(2k+1) = F(k)2+F(k+1)2, recursing on N/2 (equivalently, 2×2 matrix power).

Complexity: O(log N)

Watch out: Beware negative intermediate (2F(k+1)−F(k)) — normalize mod p before multiplying.