Given two integer arrays X[] and Y[] of size m and n, respectively, write a program to find the intersection of these two arrays. The intersection of two arrays is a list of distinct numbers which are present in both arrays. The numbers in the intersection can be in any order.

EnjoyAlgorithms

Given an array X[] of distinct elements, write a program to find all the unique triplets in the array whose sum is equal to zero.

EnjoyAlgorithms

Write a program to Implement a queue using the stack. The implemented queue should support standard operations like enqueue, dequeue, and front. This is an excellent problem to learn problem-solving and visualize the use case of stack and queue operations.

EnjoyAlgorithms

Given a binary tree, find its minimum depth. The minimum depth is the number of nodes along the shortest path from the root node down to the nearest leaf node. The path has to end on a leaf node.

EnjoyAlgorithms

Given a Roman numeral, write a program to find its corresponding decimal value. Roman numerals are represented by seven different symbols: I , V, X, L, C, D and M.

EnjoyAlgorithms

Given an array A[] of integers, find out the maximum difference between any two elements such that the larger element appears after, the smaller element. In other words, we need to find max(A[j] - A[i]), where A[j] > A[i] and j > i.

EnjoyAlgorithms

Given an array X[] of size n, write a program to find the most frequent element in the array, i.e. the element which occurs the most number of times. It is assumed that at least one element is repeated.

EnjoyAlgorithms

Given an array of n integers and a target number, write a program to check whether a pair sum exits in the array or not. In other words, we need to check whether pair of elements in the array sum exactly to the target value.

EnjoyAlgorithms

Given an n x n 2D matrix representing an image, rotate the image by 90 degrees in an anticlockwise direction.

EnjoyAlgorithms

Write a program to remove the duplicates from the sorted array. For this we are given a sorted array, the task is to remove the duplicate elements such that there is a single occurrence of each element in the array.

EnjoyAlgorithms

Given an array of n non-negative integers height[n], where each represents a point at coordinate (i, height[i]). n vertical lines are drawn such that the two endpoints of line i is at (i, height[i]) and (i, 0). Write a program to find two lines, which together with the x-axis forms a container, such that the container contains the most water.

EnjoyAlgorithms

Given an array a[] consisting of 0s, 1s, and 2s. Write a program to sort the array of 0’s, 1’s, and 2’s in ascending order. This is a famous coding interview problem asked in facebook, microsoft and amazon.

EnjoyAlgorithms

Given an array X[] of size n, we need to find the maximum and minimum element present in the array. This coding problem has been asked during facebook and microsoft interview.

EnjoyAlgorithms

Given an array X[] of n elements filled with several integers, some of them being zeroes, write a program to move all the zeroes to the end. This is an excellent coding problem to learn space and time complexity optimization.

EnjoyAlgorithms