## Scramble String

Problem Statement “Scramble String” problem states that you are given two strings. Check if the second string is a scrambled string of first one or not? Explanation Let string s = “great” Representation of s as binary tree by recursively dividing it into two non-empty sub-strings. This string can be …

## Maximum Distance Between two Occurrences of Same Element in Array

Suppose you are given an array with some repeated numbers. We have to find the maximum distance between the two same occurrences of a number with different index, present in an array. Example Input: array = [1, 2, 3, 6, 2, 7] Output: 3 Explanation: Because elements at array [1] …

## All Unique Triplets that Sum up to a Given Value

We have given an array of integers and a given number called ‘sum’. The problem statement asks to find out the triplet that adds up to the given number ‘sum’. Example Input: arr[] = {3,5,7,5,6,1} sum=16 Output: (3, 7, 6), (5, 5, 6) Explanation: Triplet which equals to the given …

## Count Subarrays with Same Even and Odd Elements

Suppose you have given an integer array of N size. As there are numbers, numbers are odd or even. The problem statement is count subarray with the same even and odd elements or finds out the count of sub-arrays that has an equal number of even and odd integers. Example …

## Rearrange an Array Such that arr[i] is equal to i

“Rearrange an array such that arr[i]=i”  problem states that you are given an array of integers ranging from 0 to n-1. Since all the elements may not be present in the array, then in place of them -1 is there. The problem statement asks to rearrange the array in such …

## Find Largest d in Array such that a + b + c = d

Problem Statement Suppose you have an array of integers. Input values are all distinct elements. The problem “Find largest d in array such that a + b + c = d” asks to find out the largest element ‘d’ in the set such that a + b + c = …

## Maximize Elements Using Another Array

Suppose, we have given two integers array of same size n. Both of the arrays contain positive numbers. The problem statement asks to maximize the first array by using the second array element keeping the second array as a priority (elements of the second array should appear first in output). …

## Write Code to Determine if Two Trees are Identical

The problem “Write Code to Determine if Two Trees are Identical” states that you are given two binary trees. find out if they are identical or not? Here, identical tree means that both the binary trees have the same node value with the same arrangement of nodes. Example Both trees …

## Find elements which are present in first array and not in second

The problem “Find elements which are present in first array and not in second” states that you are given two arrays. Arrays consist of all the integers. You have to find out the numbers which will not be present in the second array but present in the first array. Example …

## Diagonal Traversal of Binary Tree

Problem Statement The problem “Diagonal Traversal of Binary Tree” states that you are given a binary tree and now you need to find the diagonal view for the given tree. When we see a tree from the top-right direction. The nodes which are visible to us is the diagonal view …

Translate »