Problem Description: Given a binary tree, return all root-to-leaf paths. Leetcode /** * Definition for a binary tree node. * […]

# Category: Recursion

## Recursive flatten with lazy evaluation iterator

Problem I’m trying to rewrite this: def flatten(lst): flat = [] for x in lst: if hasattr(x, ‘__iter__’) and not […]

## Integer to English challenge

Problem I have a challenge, which is to create a JavaScript function that turns a given number into the string […]

## Count digits in a given number using recursion

Problem Here is my code that finds the number of digits in a given integer (either positive or negative). The […]

## Ruby Fibonacci(n) recursive computation optimized with reflection

Problem The idea is to take the common-known (and awfully bad performing) Fibonacci(n) recursive method: # recursively computate fibonacci(n) def […]

## Recursive os.scandir() for copying/moving files preserving subdirectories

Problem This is modified from the general recursive solution here: https://stackoverflow.com/a/54544211/42346 to, more specifically, copy/move files with a given extension […]

## Recursive binary search in Python

Problem I have implemented a recursive binary search in Python and tried to implement some verification to my code. Other […]

## Tower of Hanoi with helper function

Problem Here is my solution to the Tower of Hanoi problem using Python def helper(number_rings: int, origin: int, target: int, […]

## Python: pass “mutable integer” in recursion

Problem I’m working on some code to find the max depth/height in a tree. I came up with a recursive […]

## A “map” function that alternates between two mapping functions

Problem I am trying to solve following problem in Haskell using recursion: Define a recursive function funkyMap :: (a -> […]