## Minimum Distance Between BST Nodes Leetcode Solution

The problem Minimum Distance Between BST Nodes Leetcode Solution states that you are provided with a Binary Search Tree. And you are required to find the minimum difference in the entire BST. So, you need to find the minimum absolute difference between any two nodes in the BST. A BST …

## Maximum Depth of Binary Tree Leetcode Solution

Problem Statement   In the problem a binary tree is given and we have to find out the maximum depth of the given tree. A binary tree’s maximum depth is the number of nodes along the longest path from the root node down to the farthest leaf node. Example 3 / …

## Letter Combinations of a Phone Number

In letter combinations of a phone number problem, we have given a string containing numbers from 2 to 9. The problem is to find all the possible combinations that could be represented by that number if every number has some letters assigned to it. The assignment of the number is …

## Generate all possible sorted arrays from alternate elements of two given sorted arrays

The problem “Generate all possible sorted arrays from alternate elements of two given sorted arrays” states that suppose you have two sorted arrays. The problem statement asks to find out all the possible sorted arrays, such that number should be arranged alternatively from the two given different arrays. Example   ArrA[] …

## Sort a stack using recursion

Problem Statement   The problem “Sort a stack using recursion” states that you are given a stack data structure. Sort its elements using recursion. Only the below-listed functions of the stack can be used – push(element) – to insert the element in the stack. pop() – pop() – to remove/delete the …

## Delete middle element of a stack

Problem Statement   Given a data structure (stack). Write a program to delete the middle element of the given stack using the basic functions of the stack – push() – to insert an element in the stack. pop() – to remove/delete the top element from the stack. empty() – to check …

## Shuffle 2n integers as a1-b1-a2-b2-a3-b3-..bn without using extra space

Problem Statement   You are given an array of integers. The problem “Shuffle 2n integers as a1-b1-a2-b2-a3-b3-..bn without using extra space” asks to shuffle all the numbers in the array such that the numbers which are like (x0, x1, x2, x3, y0, y1, y2, y3) will be shuffled like x0, y0, …

## Balanced Binary Tree

In the balanced binary tree problem, we have given the root of a binary tree. We have to determine whether or not it is height balance. Examples   Input Output true Input Output: false Balanced Binary Tree   Every node in a balanced binary tree has a difference of 1 or less …

## Reversing a Queue using Recursion

In reversing a queue using recursion problem we have given a queue, write a recursive algorithm to reverse the queue using recursion. Examples   Input 10 -> 9 -> 3 -> 11 -> 5 Output 5 -> 11 -> 3 -> 9 -> 10 Input 1 -> 2 -> 3 -> …

## Reverse a Stack Using Recursion

In reverse a stack using recursion problem, we have given a stack data structure. Reverse its elements using recursion. Only the below-listed functions of the stack can be used – push(element) – to insert the element in the stack. pop() – to remove/delete the element at the top of the …