Tag Archives: Kattis

Competitive programming in Haskell challenge: Letter Optimization

Now that I’ve wrapped up my series of posts on Infinite 2D Array (challenge, part 1, part 2, part 3), I’d like to tackle another topic related to competitive programming in Haskell. I won’t tell you what the topic is … Continue reading

Posted in competitive programming, haskell | Tagged , , | 2 Comments

Competitive programming in Haskell: Infinite 2D array, Level 4

In a previous post, I challenged you to solve Infinite 2D Array using Haskell. After deriving a formula for that involves only a linear number of terms, last time we discussed how to efficiently calculate Fibonacci numbers and binomial coefficients … Continue reading

Posted in competitive programming, haskell | Tagged , , | 3 Comments

Competitive programming in Haskell: Infinite 2D array, Levels 2 and 3

In a previous post, I challenged you to solve Infinite 2D Array using Haskell. As a reminder, the problem specifies a two-parameter recurrence , given by for for for . Last time, we derived a formula for that involves only … Continue reading

Posted in competitive programming, haskell | Tagged , , | 1 Comment

Competitive programming in Haskell: Infinite 2D array, Level 1

In my previous post, I challenged you to solve Infinite 2D Array using Haskell. As a reminder, the problem specifies a two-parameter recurrence , given by for for for . We are given particular values of and , and asked … Continue reading

Posted in competitive programming, haskell | Tagged , , | 2 Comments

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 ? Level 2: In general, how can you … Continue reading

Posted in competitive programming, haskell | Tagged , , | 8 Comments

Competitive programming in Haskell: BFS, part 4 (implementation via STUArray)

In a previous post, we saw one way to implement our BFS API, but I claimed that it is not fast enough to solve Modulo Solitaire. Today, I want to demonstrate a faster implementation. (It’s almost certainly possible to make … Continue reading

Posted in competitive programming, haskell | Tagged , , , , , , | 3 Comments

Competitive programming in Haskell: Enumeration

I’m in the middle of a multi-part series on implementing BFS in Haskell. In my last post, we saw one implementation, but I claimed that it is not fast enough to solve Modulo Solitaire, and I promised to show off … Continue reading

Posted in competitive programming, haskell | Tagged , , , , | 1 Comment

Competitive programming in Haskell: BFS, part 3 (implementation via HashMap)

In a previous post, I showed how we can solve Modulo Solitaire (and hopefully other BFS problems as well) using a certain API for BFS, and we also explored some alternatives. I had a very interesting discussion with Andrey Mokhov … Continue reading

Posted in competitive programming, haskell | Tagged , , , , , | 6 Comments

Competitive programming in Haskell: BFS, part 2 (alternative APIs)

In my last post, I showed how we can solve Modulo Solitaire (and hopefully other BFS problems as well) using a certain API for BFS, which returns two functions: one, level :: v -> Maybe Int, gives the level (i.e. … Continue reading

Posted in competitive programming, haskell | Tagged , , , , | 6 Comments

Competitive programming in Haskell: BFS, part 1

In a previous post, I challenged you to solve Modulo Solitaire. In this problem, we are given a starting number and are trying to reach in as few moves as possible. At each move, we may pick one of up … Continue reading

Posted in competitive programming, haskell | Tagged , , , , | 5 Comments