All Questions
Tagged with programming-challenge recursion
77
questions
2
votes
3
answers
540
views
Recursive palindrome check
I'm trying to solve this which basically calls for a recursive palindrome check with some minor extra steps (Special characters and whitespace can be ignored). The test inputs' length can be 100000 ...
2
votes
2
answers
223
views
Generate the number of partitions of each integer
I've coded a program that calculates the number of partitions of n into at least two distinct parts, and is relatively quick too (about N^1.5 complexity). For input 30 000 it takes roughly 4 seconds. ...
3
votes
0
answers
148
views
Finding the number of possible paths in a cave system (Python)
I've finally come up with working solution for day 12 of AdventOfCode, where you have to find the number of possible paths in a cave system following a given set of rules (described below). My ...
1
vote
0
answers
351
views
Codewars: Path Finder
Task
You are at position [0, 0] in maze NxN and you can only move in one of the four cardinal directions (i.e. North, East, South, West). Return true if you can reach position [N-1, N-1] or false ...
3
votes
1
answer
218
views
Killing a Hydra - Overengineered
Background
This question is inspired by the question: Killing a hydra, and my response therein. I will restate the problem at hand in full so that this question is fully self contained
You can only ...
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
309
views
LeetCode: Stone Game C#
https://leetcode.com/problems/stone-game/
Alex and Lee play a game with piles of stones. There are an even
number of piles arranged in a row, and each pile has a positive
integer number of stones ...
5
votes
1
answer
258
views
Hackerrank: Breaking the records
I'm learning Clojure and am a rank n00b at it, trying to learn from books and online tutorials (but I'm sometimes concerned that I am picking up bad habits or at least not all the good habits). For ...
1
vote
2
answers
238
views
Recursive brute-force approach to maximum points you can obtain from cards
I came across this question on Leetcode. The question description is as follows:
There are several cards arranged in a row, and each card has an associated number of points.
The points are given in ...
9
votes
1
answer
935
views
Number in words: recursive function
I would appreciate some feedback on the below code I wrote for a Project Euler problem. The answer comes out correct but I'd like feedback on the design of the function and implementation of ...
7
votes
2
answers
1k
views
Letter Combinations of a phone number using a Dictionary
Problem statement (online source)
Given a digit string, return all possible letter combinations that the
number could represent.
A mapping of digit to letters (just like on the telephone ...
1
vote
0
answers
79
views
Recursion to dynamic programming [closed]
I was trying to solve a problem on de-arrangements (Number of partial derangement such that exactly prime number discs are found away from their natural positions? (Any number of non-prime K disks ...
2
votes
0
answers
98
views
Leetcode Finding Maximum Area of Island Solution
Given a non-empty 2D array grid of 0's and 1's, an island is a group
of 1's (representing land) connected 4-directionally (horizontal or
vertical.) You may assume all four edges of the grid are ...
5
votes
2
answers
181
views
Code Challenge: basic arithmic operations using only incrementation operator
Challenge
Write a function that takes 2 integer operands left and right
(both >= 0) and evaluates one of the following ...
3
votes
1
answer
559
views
Find A Series of Numbers Who when Squared and Summed are equal to a given Square
I am working on a CodeWars titled 'Square into Squares. Protect trees!' it can be found here: https://www.codewars.com/kata/54eb33e5bc1a25440d000891/train/javascript
I have a working solution, the ...