## Search in a Binary Search Tree Leetcode Solution

In this problem, we are given a Binary Search Tree and an integer. We need to find the address of a node with value same as the given integer. As a check, we need to print the preorder traversal of the sub-tree that has this node as root. If there …

## Merge Two Sorted Lists Leetcode Solutions

Linked lists are quite like arrays in their linear properties. We can merge two sorted arrays to form an overall sorted array. In this problem, we have to merge two sorted linked lists in place to return a new list which contains elements of both lists in a sorted fashion. Example   …

## Merge Sorted Arrays Leetcode Solution

In the problem “Merge Sorted Arrays”, we are given two arrays sorted in non-descending order. The first array is not fully filled and has enough space to accommodate all elements of the second array as well. We have to merge the two arrays, such that the first array contains elements …

## k-th missing element in increasing sequence which is not present in a given sequence

The problem “k-th missing element in increasing sequence which is not present in a given sequence” states that you are given two arrays. One of them is arranged in ascending order and another normal unsorted array with number k. Find the kth missing element which is not present in normal …

## Maximum product of an increasing subsequence

Problem Statement   The problem “Maximum product of an increasing subsequence” states that you are given an array of integers. Now you need to find out the maximum product you can achieve such that you multiply the elements of an increasing subsequence. The thing to note is that, we are not …

## Check in binary array the number represented by a subarray is odd or even

The problem “Check in binary array the number represented by a subarray is odd or even” states that you are given a binary array and a range. The array consists of the number in the form of 0s and 1s. The problem statement asks to find out the number represented …

## 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 …

## Sorting array using Stacks

Problem statement   The problem “Sorting array using Stacks” states that you are given a data structure array a[ ] of size n. Sort the elements of the given array using stack data structure. Example   2 30 -5 43 100 -5 2 30 43 100 Explanation: The elements are sorted in …

## Sort a stack using a temporary stack

Problem Statement   The problem “Sort a stack using a temporary stack” states that you are given a stack data structure. Sort the elements of the given stack using a temporary stack. Example   9 4 2 -1 6 20 20 9 6 4 2 -1 2 1 4 3 6 5 …

## Rearrange a binary string as alternate x and y occurrences

Problem Statement   Suppose you are given a binary string, and two numbers x and y. The string consists of 0s and 1s only. The problem “Rearrange a binary string as alternate x and y occurrences” asks to rearrange the string such that the 0 comes x times ⇒ 1 comes …