All Questions
Tagged with functional-programming programming-challenge
111 questions
6
votes
1
answer
129
views
Locate and multiply numbers in a 2D grid (Advent of Code 2023 Day 3, Part 2)
I am using the Advent of Code 2023 to study functional programming and the ranges library in C++. This code is for the second part of Day 3 and is the best solution using FB I've created. I'd ...
4
votes
2
answers
749
views
MP3 Playlist Class in Python
Background Info
I am an intermediate level Python programmer. This is my implementation of a MP3 Playlist class challenge that was hosted on 101 Computing.Net. The ...
4
votes
0
answers
216
views
GeekTrust: Traffic problem - functional programming
First attempt to write functional programming, been following OO paradigm all through my programming journey
Please review the code and let me know if any comments and violations of functional ...
3
votes
1
answer
271
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
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.
...
2
votes
3
answers
166
views
Finds Keywords in Log Files
This is my first project in C and I wanted a more experienced person's insight on how I made the whole program. Just looking for feedback it works how I want it to. The Github is here. Thank you so ...
2
votes
1
answer
97
views
Project Euler 1 using functional programming in JS
So I am once again beating a dead horse, by solving the first Project Euler problem:
If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these ...
2
votes
0
answers
116
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
253
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 ...
5
votes
2
answers
164
views
sum of multiples by 3 or 5 using ranges
This program calculates the sum of all integers in the range \$[1, 1000)\$ which are multiples of either 3 or 5 or both.
Inspired by x86-64 Assembly - Sum of multiples of 3 or 5 the other day, and ...
2
votes
1
answer
121
views
Extract values from English numerals, e.g. "nine million and one"
Though many have done it the other way around, I have not seen such code in many places. And, to be honest, I don't know why this cluster of if-statements, ...
2
votes
2
answers
106
views
HackerRank - Filter huge list for elements that occur more than a given number of times
I'm trying to solve this problem on HackerRank, which basically requires the solution to read an input like this (comments are mine)
...
3
votes
2
answers
162
views
Leap year check in Java (functional style)
I have done the leap year check on https://exercism.io already in a lot of languages. Today I came back to the exercise in Java and was playing around with some maybe more funny ways to do the check. ...
1
vote
1
answer
310
views
Provide functional-programming style solution for 2D Array - DS challenge
Problem Statement:
Given a 6×6 2D Array, arr:
1 1 1 0 0 0
0 1 0 0 0 0
1 1 1 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
We define an hourglass in A to be a subset of ...
5
votes
2
answers
319
views
Counting valleys traversed below sea level, given elevation changes
Problem Statement:
Gary is an avid hiker. He tracks his hikes meticulously, paying close
attention to small details like topography. During his last hike he
took exactly steps. For every step he ...