## Subset with sum divisible by m

Problem Statement   The problem “Subset with sum divisible by m” states that you are given an array of non-negative integers and an integer m. Now you need to find if there is a subset having sum divisible by m. That is the sum of the subset should give 0 as …

## Minimum Operations to convert X to Y

Problem Statement   The problem “Minimum Operations to convert X to Y” states that you are given two numbers X and Y, it is needed to convert X into Y using following operations: Starting number is X. Following operations can be performed on X and on the numbers that are generated …

## Maximum Product Subarray

Problem Statement   The problem “Maximum Product Subarray” states that you are given an array of integer containing both positive and negative numbers. The problem statement asks to find out the maximum product of the sub-array. Example   arr[] = { 2, -2, 3, 5} 15 Explanation The elements in the sub-array …

## Implement Stack and Queue using Deque

Problem Statement   The problem “Implement Stack and Queue using Deque” states to write an algorithm to implement Stack and Queue using a Deque(Doubly Ended Queue). Example (Stack)   Push(1) Push(2) Push(3) Pop() isEmpty() Pop() Size() 3 false 2 1 Example (Queue)   Enqueue(1) Enqueue(2) Enqueue(3) Dequeue isEmpty() Size() Dequeue() 1 false 2 …

## Word Wrap Problem

Problem Statement   The word wrap problem states that given a sequence of words as input, we need to find the number of words that can be fitted in a single line at a time. So, for doing this we put breaks in the given sequence such that the printed document …

## Find Number of Employees Under every Employee

HashMaps are one of the most useful data structures. Find the number of employees under every employee is a problem that reminds me of the famous movie’s inception. Akin to dream in a dream. Here, we have an employee working under an employee and so on. Problem Statement   So, what …

## Count Subsets Having Distinct Even Numbers

We have all struggled with the subset problem at some point or the other in an interview. The interviewers love these problems too. These problems help them examine the understanding as well as the thought process of any student. So, without any further ado let us jump straight into the …

## Find Pythagorean Triplets from Array

Problem Statement   We have given an array that contains n integers. We need to find the set of Pythagorean triples from the given array. Note: Pythagorean triplets condition: a^2 + b^2 = c^2. Example   Input 6 [3, 4, 6, 5, 7, 8] Output Please click Like if you loved this … 