Array practice problems:

Most of these problems are taken from geeksforgeeks.org


===========================================
Find the missing number in an array

===========================================
Reverse an array

===========================================
Sort elements by frequency

===========================================
Check for majority element in a sorted array

Write a C function to find if a given integer x appears more than n/2 times in a sorted array of n integers.

===========================================
Find the k largest (smallest) elements in an array

===========================================
Find the union and the intersection of two sorted arrays

===========================================
Find duplicates in an array

Given an array of n elements which contains elements from 0 to n-1, with any of these numbers appearing any number of times. Find these repeating numbers in O(n) and using only constant memory space.

For example, let n be 7 and array be {1, 2, 3, 1, 3, 6, 6}, 
the answer should be 1, 3 and 6.
===========================================
Find the maximum of all subarrays of size k

===========================================
Find a subarray with a given sum

===========================================
Move all zeros to the end of an array

Given an array of random numbers, Push all the zero’s of a given array to the end of the array. For example, if the given arrays is {1, 9, 8, 4, 0, 0, 2, 7, 0, 6, 0}, it should be changed to {1, 9, 8, 4, 2, 7, 6, 0, 0, 0, 0}. The order of all other elements should be same. Expected time complexity is O(n) and extra space is O(1).