We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
So for haskell you have to kind of get weird with it. The list random access operator is too slow to solve this the way I think you normally would. What I do it generate the list of pentagonal numbers and then access them in the order the test cases require. I noticed that they are either ascending or descending but also in order up to the amount provided. That's how I got around using the !! operator. Let me know if there's an actual performant dp solution.
Pentagonal Numbers
You are viewing a single comment's thread. Return to all comments →
So for haskell you have to kind of get weird with it. The list random access operator is too slow to solve this the way I think you normally would. What I do it generate the list of pentagonal numbers and then access them in the order the test cases require. I noticed that they are either ascending or descending but also in order up to the amount provided. That's how I got around using the !! operator. Let me know if there's an actual performant dp solution.