## Union and Intersection of two sorted arrays

Given two sorted arrays, find their union and intersection. Example: Input : arr1[] = {1, 3, 4, 5, 7} arr2[] = {2, 3, 5, 6}… Read More »

- Make all numbers of an array equal
- Optimal Strategy for a Game | Set 2
- Sliding Window Maximum (Maximum of all subarrays of size k) using stack in O(n) time
- Sum of XOR of all subarrays
- Find k closest numbers in an unsorted array
- Count pairs in array whose sum is divisible by K
- Building Heap from Array
- Amazon Internship Interview Experience
- Program for K Most Recently Used (MRU) Apps
- Merge K sorted arrays | Set 3 ( Using Divide and Conquer Approach )
- Longest subsequence such that adjacent elements have at least one common digit
- k-th missing element in an unsorted array
- Minimum operations required to make all the array elements equal
- Count of pairs (x, y) in an array such that x < y
- Maximum sum such that no two elements are adjacent | Set 2
- Number of unique pairs in an array
- Check if given Preorder, Inorder and Postorder traversals are of same tree | Set 2
- Merge K sorted arrays of different sizes | ( Divide and Conquer Approach )
- Maximum element in a sorted and rotated array
- Length of the longest alternating subarray
- Minimum elements to be removed such that sum of adjacent elements is always even
- Given two arrays count all pairs whose sum is an odd number
- Array Manipulation and Sum
- Remove minimum elements from either side such that 2*min becomes more than max | Set 2
- Sort an array without changing position of negative numbers
- Count array elements that divide the sum of all other elements
- Create linked list from a given array
- Find minimum difference between any two elements | Set 2
- Find two numbers whose divisors are given in a random order
- Maximum absolute difference in an array

Given two sorted arrays, find their union and intersection. Example: Input : arr1[] = {1, 3, 4, 5, 7} arr2[] = {2, 3, 5, 6}… Read More »

Given an array arr[] of integers, find out the maximum difference between any two elements such that larger element appears after the smaller number. Examples… Read More »

Question: Write an efficient program for printing k largest elements in an array. Elements in array can be in any order. For example, if given… Read More »

You are given an array of 0s and 1s in random order. Segregate 0s on left side and 1s on right side of the array.… Read More »

Write a C function to return minimum and maximum in an array. You program should make minimum number of comparisons. Recommended: Please solve it on… Read More »

Question: Write a C function to find if a given integer x appears more than n/2 times in a sorted array of n integers. Basically,… Read More »

Write an efficient C program to find smallest and second smallest element in an array. Example: Input: arr[] = {12, 13, 1, 10, 34, 1}… Read More »

Question: An Array of integers is given, both +ve and -ve. You need to find the two elements such that their sum is closest to… Read More »

Inversion Count for an array indicates – how far (or close) the array is from being sorted. If array is already sorted then inversion count… Read More »

Print the elements of an array in the decreasing frequency if 2 numbers have same frequency then print the one which came first. Examples: Input:… Read More »

Write a program to print all the LEADERS in the array. An element is leader if it is greater than all the elements to its… Read More »

Given an array of positive numbers, find the maximum sum of a subsequence with the constraint that no 2 numbers in the sequence should be… Read More »

Write a function rotate(ar[], d, n) that rotates arr[] of size n by d elements. Rotation of the above array by 2 will make array… Read More »

Write a function rotate(arr[], d, n) that rotates arr[] of size n by d elements. Example : Input : arr[] = [1, 2, 3, 4,… Read More »

Write a function rotate(arr[], d, n) that rotates arr[] of size n by d elements. Example: Input: arr[] = [1, 2, 3, 4, 5, 6,… Read More »