Competitive programming in Haskell: Infinite 2D array
If you like number theory, combinatorics, and/or optimizing Haskell code, I challenge you to solve Infinite 2D Array using Haskell.
- Level 1: can you come up with a general formula to compute \(F_{x,y}\)?
- Level 2: In general, how can you efficiently compute \(F_{x,y} \pmod {10^9 + 7}\)?
- Level 3: Now implement the above ideas in Haskell so your solution actually fits within the 1 second time limit.
I have solved it but it was definitely challenging. In a subsequent blog post I’ll talk about my solution and ask for other optimization ideas.