Recursion

Questions based on recursions

Easy

20 minutes

Implement Currying

Create a function `sum` that implements currying. Currying is a transformation of functions that translates a function from being callable as f(x, y, ...

Easy

30 minutes

BST Traversal

Given a Binary Search Tree, Traverse the tree in Preorder, Postorder, and inorder traversal.

Easy

30 minutes

Branch Sums in a Binary Tree

Given a Binary Tree, compute the sum of all the branches in the tree. 1 branch is the path from the root to a leaf.

Medium

30 minutes

Spiral Traversal

Given a 2D matrix of numbers, return a spiral traversal of the matrix in the clockwise direction.

Medium

30 minutes

Invert Binary Tree

Given a binary tree, invert the binary tree - Inverting a binary tree means that the resulting binary tree should be a mirror replica of the input bin...

Easy

30 minutes

Product Sum

Given an array (that can have nested arrays) - return the sum of all the numbers in the array. If nested array is encountered, recursively add the num...

Medium

30 minutes

Binary Tree Diameter

Given a Binary Tree, Return an integer that represents the diameter of the Binary Tree. A Diameter is the length of the longest path in the Binary Tre...

Easy

30 minutes

Depth First Search

Depth-first search (DFS) is an algorithm for traversing or searching tree or graph data structures. The algorithm starts at the root node (selecting s...

Medium

30 minutes

Height Balanced Binary Tree

Given a pointer to the root node of a binary tree, return true if the binary tree is height-balanced. A height-balanced binary tree is a Binary tree i...

Easy

20 minutes

Palindrome Check

Given a string of characters, Check if the given string is a palindrome or not. A palindrome is a word, phrase, or sequence that reads the same backwa...

Medium

30 minutes

Find Successor

Given the root of a binary tree and a node in it, return the in-order successor of that node in the BST. If the given node has no in-order successor i...