Find whether an array is subset of another array

The problem “Find whether an array is subset of another array” states that you are given two arrays arra1[] and array2[]. The arrays given are in an unsorted manner. Your task is to find whether the array2[] is a subset of array1[]. Example arr1= [1,4,5,7,8,2] arr2= [1,7,2,4] arr2 [] is …

Read moreFind whether an array is subset of another array

Minimum sum of multiplications of n numbers

The problem “Minimum sum of multiplications of n numbers” states that you are given n integers and you need to minimize the sum of multiplication of all the numbers by taking two elements that are adjacent at a time and putting back their sum mod 100 until a single number …

Read moreMinimum sum of multiplications of n numbers

Count ways to reach the nth stair using step 1, 2 or 3

The problem “Count ways to reach the nth stair using step 1, 2, or 3” states that you are standing on the ground. Now you need to reach the end of the staircase. So how many ways are there to reach the end if you can jump only 1, 2, …

Read moreCount ways to reach the nth stair using step 1, 2 or 3

Find subarray with given sum (Handles Negative Numbers)

The problem “Find subarray with given sum (Handles Negative Numbers)” states that you are given an integer array, containing negative integers as well and a number called “sum”. The problem statement asks to print the sub-array, which sums up to a given number called “sum”.  If more than one sub-array …

Read moreFind subarray with given sum (Handles Negative Numbers)

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 …

Read moreWrite Code to Determine if Two Trees are Identical

Count even length binary sequences with same sum of first and second half bits

The problem “Count even length binary sequences with same sum of first and second half bits” states that you are given an integer. Now find out the number of ways to construct a binary sequence of size 2*n such that the first half and second half have the same number …

Read moreCount even length binary sequences with same sum of first and second half bits

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 …

Read moreMaximum product of an increasing subsequence

Delete a Node from linked list without head pointer

Problem Statement The problem “Delete a Node from linked list without head pointer” states that you have a linked list with some nodes. Now you want to delete a node but you don’t have its parent node address. So delete this node. Example 2->3->4->5->6->7 Node to be deleted: 4 2->3->5->6->7 …

Read moreDelete a Node from linked list without head pointer