All Questions
Tagged with programming-challenge haskell
98
questions
2
votes
0
answers
26
views
Last Stone Weight Problem in Haskell Using `fold`
A previous solution of this code has been posted on Code Review before.
This solution is more complicated then that one, but more performant (see the below)
Why is this another Question instead of a ...
4
votes
1
answer
150
views
Last Stone Weight Problem in Haskell using list `insert`
Background
Saw this problem on TheJobOverflow which seems to be a LeetCode question.
It bothered me that the "challenge" of this problem was to recognize the need for a specific data-type (...
3
votes
1
answer
97
views
Autocomplete system with prefix tree
I am quite new to Haskell, and this problem is from dailycodingproblem.com:
Implement an autocomplete system.
That is, given a query string s and a set of all ...
1
vote
1
answer
117
views
Count islands in a binary grid
This is the No of Island code challenge.
Please review my implementation in Haskell. I know there must be some better way of doing this.
Given an m x n 2D binary grid grid which represents a map of '...
0
votes
1
answer
74
views
Haskell solution to Day 2 problem of Advent of Code '21
I won't restate the problem in full, but in a nutshell you have to parse a file with a "direction" and a "magnitude", for instance:
...
3
votes
1
answer
136
views
Function to sum all Armstrong numbers within a range
I've tried to solve a challenge posted on a LinkedIn forum using Haskell - a language I'm still learning the basics of - and, while the code works correctly, I would like to get some feedback on the ...
2
votes
1
answer
118
views
Advent of Code 2021 Day 4
Here is my attempt at Advent of Code Day 4 using Haskell.
A file contains list of number in first line. And subsequent lines have the bingo Cards
...
2
votes
1
answer
177
views
AdventofCode 2021: Day 3 Solution
I am beginner to Haskell. Here is my solution to Advent of Code 2021 Day 3. Let me know what you think. I was looking at the transpose function and decided not to use head & tail function.
Given ...
3
votes
1
answer
248
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 ...
3
votes
0
answers
188
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.
...
6
votes
2
answers
2k
views
Hamming distance between two strings
I wrote this module to find the Hamming distance between two strings. (It's a problem from exercism.io's Haskell track.)
As I saw it, the problem has two distinct ...
2
votes
0
answers
109
views
Partial Function composability in Haskell
Below is my solution for the CTFP chapter 4 challenges which essentially involves composing partial functions (that don't have defined outputs for all possible inputs i.e. returning a Maybe).
The ...
1
vote
1
answer
237
views
"Sequence full of colors" challenge on HackerRank
This is the challenge:
You are given a sequence of N balls in 4 colors: red, green, yellow and blue. The sequence is full of colors if and only if all of the ...
3
votes
0
answers
123
views
Performance issue regarding Project Euler #60 in Scheme
I solved Project Euler #60:
The primes 3, 7, 109, and 673, are quite remarkable. By taking any two primes and concatenating them in any order the result will always be prime. For example, taking 7 ...
2
votes
1
answer
129
views
HackerRank - Binary tree to compute the Nth power of natural numbers that sum up to X
I'm trying to solve this challenge on HackerRank.
In short, given x and n, I have to determine how many ways I can pick numbers ...