Skip to main content

8 docs tagged with "Recursion"

View all tags

Balanced Binary Tree

Determine if a given binary tree is height-balanced, meaning the heights of the two subtrees of every node never differ by more than one.

Climbing Stairs

You need to find the number of distinct ways to climb a staircase with `n` steps, given that you can take either 1 or 2 steps at a time.

Flood Fill

Given a 2D grid representing an image, a starting pixel's coordinates, and a new color, change the color of the starting pixel and all…

Invert Binary Tree

Given the root of a binary tree, invert the tree by swapping its left and right children at each node.

Permutations

Find all possible arrangements of distinct integers in an array.

Reverse Linked List

Given the head of a singly linked list, reverse the list and return the head of the reversed list.