All Questions
Tagged with recursion functional-programming
47 questions
3
votes
2
answers
2k
views
Haskell Function to get the List representation of an Integral
This is a simple practice problem. The task is to write a function getLR that receives an Integral, ...
3
votes
1
answer
335
views
Efficiently calculate value of Pascal's Triangle using memoization and recursion
So reading about functional programming, applications to dynamic programming, and learning Scala. I figured I would try it out with a popular example, Pascal's Triangle, tests against known values ...
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
0
answers
160
views
Hutton cipher implemented using recursive functions
Is there a way to rewrite these last 2 recursive functions with fewer arguments (preferably 2) while keeping them recursive?
The entire code can be seen here: https://github.com/GirkovArpa/hutton-...
7
votes
1
answer
371
views
Mutual recursion - Naming the opponent serve - pingpong
Problem statement
Ping-pong
The ping-pong sequence counts up starting from 1 and is always either counting up or counting down. At element k, the direction switches if k is a multiple of 7 or ...
3
votes
1
answer
334
views
Longest Substring without Repeating Characters Problem - Kotlin Recursion
I am practicing coding questions on leetcode. I have been an OOP my whole career, and I am trying to wade into the dark abyss that is functional programming. So I am trying to do things purely ...
2
votes
0
answers
187
views
generic implementation approaches for a recursive function
Let's take the famous fibonacci problem as an example but this is a generic problem. Also, taking scala as the language as it's rather feature-rich. I want to know which solution you'd prefer.
we all ...
4
votes
2
answers
99
views
User defined function call on a stack based interpreter for concatenative language
I would like to receive some advice on how to improve a small concatenative stack-based interpreter, executing a joy-like programming language. It is really minimal, and is in fact a subset of a ...
4
votes
2
answers
342
views
Roman Numbers - The Functional Way
Yet another exercise in converting values between the decimal and roman number systems.
I have tried the functional way.
Any comments are welcome - but I'm especially interested in answers focusing ...
4
votes
1
answer
553
views
React.js Nested Nav Bar
This was written for a coding challenge for a company I recently starting working for. I'm looking for any suggestions on how to clean up the code, as well as any issues anyone thinks may occur as it ...
1
vote
1
answer
124
views
Find first repeating Char in String
Given a string, find the first repeating character in it.
Examples:
firstUnique("Vikrant") → None
...
4
votes
2
answers
452
views
Replace array element with multiplication of neighbors in Scala
Given an array of integers, update the index with multiplication of previous and next integers,
Input: 2 , 3, 4, 5, 6
Output: 2*3, 2*4, 3*5, 4*6, 5*6
Following ...
2
votes
0
answers
96
views
Finding first duplicated value from "circular" list with a recursive function
Background
This year I've taken on the challenge of Advent of Code. The second challenge of the first day is to calculate a frequency for a special device based on a series of numbers. Here's a quote ...
1
vote
1
answer
663
views
C++ heap CPS: Continuation Passing Style with Recursion
I am willing to see how to write readable and efficient continuations on the heap in c++. I am not quite satisfied.
The following is just an exercise: it is coded for fun. I post the code here ...
1
vote
4
answers
717
views
Hackerrank Day 9: Recursion
Write a factorial function that takes a positive integer, N as a parameter and prints the result of N! (N factorial).
Note: If you fail to use recursion or fail to name your recursive function ...