← Optiver Interview Insights

Optiver·Software Engineer·Technical Phone Screen·Intermediate

Intermediate
Jun 2026

Summary

Optiver quant engineer interview threw a sequence puzzle at me that looked deceptively simple until I started second-guessing my own arithmetic. Classic Optiver style: short problem, lots of pressure.

Questions Asked (1)

Q1

A sequence is given: 1, 2, 5, 11, 26, 59, ?, 137. Find the missing term by identifying the underlying recurrence relation.

Algorithms & Data Structures
Author's notes

Stared at it for a bit trying to spot a ratio pattern first, which was a dead end.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

First, compute the differences between consecutive terms to see if a simple pattern emerges. If not, look for a linear recurrence relation, such as each term being a combination of previous terms. Test hypotheses like a_n = 2*a_{n-1} + a_{n-2} or similar, and verify with the given terms.

Pro tip: In interviews, clearly verbalize your thought process as you test patterns. Even if you don't immediately find the answer, demonstrating systematic exploration and mathematical reasoning is highly valued.

1. Calculate differences

Compute the first differences between consecutive terms: 2-1=1, 5-2=3, 11-5=6, 26-11=15, 59-26=33. Then compute second differences: 2, 3, 9, 18. This may reveal a pattern or suggest a recurrence.

2. Test simple recurrences

Check if each term is a multiple of the previous term plus something. For example, 2*1+0=2, 2*2+1=5, 2*5+1=11, 2*11+4=26, 2*26+7=59. The added numbers 0,1,1,4,7 don't form an obvious pattern, so try other combinations.

3. Consider linear recurrence with two previous terms

Assume a_n = p*a_{n-1} + q*a_{n-2}. Use the first few terms to set up equations: 5 = p*2 + q*1, 11 = p*5 + q*2. Solve to get p=3, q=-1? Check: 3*2 -1*1=5, 3*5 -1*2=13 ≠11. So not that. Try a_n = a_{n-1} + 2*a_{n-2}: 5=2+2*1=4? No. Try a_n = 2*a_{n-1} + a_{n-2}: 5=2*2+1=5, 11=2*5+2=12? No. Try a_n = 2*a_{n-1} + a_{n-2} - something? Alternatively, note that 1,2,5,11,26,59,?,137 might follow a_n = 2*a_{n-1} + a_{n-2} - a_{n-3}? Test: 11 = 2*5 + 2 -1 =11, 26 = 2*11 +5 -2 =25? No, 25≠26. Try a_n = a_{n-1} + 2*a_{n-2} + a_{n-3}? 11=5+2*2+1=10? No.

4. Look for pattern in differences

First differences: 1,3,6,15,33. Second differences: 2,3,9,18. Notice that 2,3,9,18 might be related to previous terms? 2=2*1, 3=3*1? Not clear. Alternatively, observe that each term might be sum of previous two plus something: 5=2+1+2, 11=5+2+4, 26=11+5+10, 59=26+11+22. The added numbers: 2,4,10,22. These are 2*1, 2*2, 2*5, 2*11? Indeed, 2,4,10,22 are twice the terms 1,2,5,11. So a_n = a_{n-1} + a_{n-2} + 2*a_{n-3}? Check: for n=4 (11): a_3+a_2+2*a_1 =5+2+2*1=9≠11. Not that.

5. Identify recurrence and solve

Notice that 1,2,5,11,26,59,?,137 might satisfy a_n = 2*a_{n-1} + a_{n-2} - a_{n-3}? Test: 11 = 2*5 + 2 -1 =11, 26 = 2*11 +5 -2 =25? No. Try a_n = a_{n-1} + 2*a_{n-2} + a_{n-3}? 11=5+2*2+1=10? No. Another idea: 1,2,5,11,26,59,?,137. Observe that 1+2+5=8, 2+5+11=18, 5+11+26=42, 11+26+59=96, 26+59+?=?, 59+?+137=? Not obvious. Alternatively, note that 1,2,5,11,26,59,?,137 might be generated by a_n = 2*a_{n-1} + a_{n-2} - a_{n-3}? Let's test with n=4: a4=2*a3+a2-a1=2*5+2-1=11 correct. n=5: a5=2*a4+a3-a2=2*11+5-2=25, but given 26. So off by 1. Maybe a_n = 2*a_{n-1} + a_{n-2} - a_{n-3} + something? Not consistent. Try a_n = a_{n-1} + 2*a_{n-2} + a_{n-3}? n=4: 5+2*2+1=10≠11. Try a_n = 2*a_{n-1} + a_{n-2} - a_{n-3} + 1? n=4: 11+1=12≠11. Hmm. Another approach: look at ratios: 2/1=2, 5/2=2.5, 11/5=2.2, 26/11≈2.36, 59/26≈2.27, 137/59≈2.32. Not constant. Maybe the sequence is every other term of a known sequence? Or perhaps it's a_n = 2*a_{n-1} + a_{n-2} - a_{n-3}? Let's solve for missing term using the recurrence a_n = 2*a_{n-1} + a_{n-2} - a_{n-3}? Check n=6: a6=2*a5+a4-a3=2*26+11-5=58, but given 59. So off by 1. Maybe a_n = 2*a_{n-1} + a_{n-2} - a_{n-3} + (n-4)? For n=4: +0 ->11, n=5: +1 ->26, n=6: +2 ->60? But given 59. Not. Try a_n = 2*a_{n-1} + a_{n-2} - a_{n-3} + (-1)^n? n=4: +1 ->12, no. Alternatively, note that 1,2,5,11,26,59,?,137 might be a_n = 2*a_{n-1} + a_{n-2} - a_{n-3}? Let's compute a7 using this: a7=2*a6+a5-a4=2*59+26-11=133, but then a8=2*a7+a6-a5=2*133+59-26=299, not 137. So not. Another pattern: 1,2,5,11,26,59,?,137. Notice that 1+2+5=8, 2+5+11=18, 5+11+26=42, 11+26+59=96, 26+59+?=?, 59+?+137=? Not. Maybe each term is sum of previous two plus previous previous? 5=2+1+2, 11=5+2+4, 26=11+5+10, 59=26+11+22. The added numbers: 2,4,10,22. These are 2*1, 2*2, 2*5, 2*11. So a_n = a_{n-1} + a_{n-2} + 2*a_{n-3}? Check n=4: a4=a3+a2+2*a1=5+2+2=9≠11. So not. But wait: 2,4,10,22 are 2*(1,2,5,11). So a_n = a_{n-1} + a_{n-2} + 2*a_{n-3}? For n

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.