Skip to main content

All Questions

3 votes
1 answer
268 views

Efficiently calculating perfect powers in Haskell

I'm trying to calculate perfect powers to solve this code wars challenge: https://www.codewars.com/kata/55f4e56315a375c1ed000159/haskell The number 81 has a special property, a certain power of the ...
jdkleuver's user avatar
3 votes
0 answers
196 views

Advent of Code 2021, Day 3 in Haskell

This is a working solution to today's Advent of Code puzzle, written in Haskell. However, I feel like this solution is not optimal. ...
Scriptim's user avatar
  • 131
4 votes
0 answers
404 views

Kattis Ants challenge

I am trying to learn Haskell doing some contest problems. I have worked a bit with the language but still have a very long way ahead. Right now I am working with a problem called Ants: An army of ...
A. Lindberg's user avatar
8 votes
1 answer
2k views

Advent of Code 2018 day 1 part 2: find the first repeated number after some increases and decreases

Here is the problem: Part Two You notice that the device repeats the same frequency change list over and over. To calibrate the device, you need to find the first frequency it reaches twice. For ...
dagda1's user avatar
  • 309
6 votes
3 answers
605 views

Sieve of Sundaram for Project Euler 7

This is a sequel to my previous question: Sieve of Sundaram for Project Euler 7: Python implementation slower than C++ and R I am trying to implement the Sieve of Sundaram in various languages to ...
castle-bravo's user avatar
2 votes
1 answer
99 views

Accessing list elements when counting the number of rectilinear paths

I am trying to solve the RIVALS problem on SPOJ: Starting from (0, 0), how many paths are there to reach point (X, Y), only taking one-unit steps moving to the right or up? Constraints: 0 ≤ X ≤ 106, ...
Lakshman's user avatar
  • 258
7 votes
3 answers
10k views

Solution to Hackerrank challenge "Sherlock and Queries"

First, here is the full challenge description: Watson gives to Sherlock an array: \$A_1, A_2, ..., A_N\$. He also gives to Sherlock two other arrays: \$B_1, B_2, ..., B_M\$ and \$C_1, C_2, ..., ...
Tobias Hermann's user avatar
4 votes
1 answer
955 views

Project Euler #14 (Longest Collatz Sequence) in Haskell

You can check the problem here: http://projecteuler.net/problem=14 My first approach in Haskell was this: ...
jj1's user avatar
  • 143
7 votes
4 answers
856 views

Finding the sum of all the multiples of 3 or 5 below 1000, using list comprehension

I'm trying to compare my own implementation with another solution of Project Euler problem #1, which uses a list comprehension: ...
Rob's user avatar
  • 324