Given a sorted array arr[] and an integer target, find the number of occurrences of target in given array.
Given an array of n integers with duplicate, output unique numbers of the array.
Find the majority element in the array
Given an array array, find the majority element that appears more than half times in the array. If no majority exists, return -1.
Find minimum and maximum of an array using minimum number of comparisons
Given an array of numbers, find the minimum and the maximum element of the array using the minimum number of comparisons.
Move negative to the beginning
An array has both positive and negative numbers in random order. Rearrange the array elements to move all negative numbers before all positive numbers.
Find the index of any peak element in a given array. A peak element is an element that is strictly greater than both of its immediate neighbors. The first and last elements of the array are considered to be adjacent to negative infinity. If multiple peaks exist, return the index of any one of them.
Reverse an array
Given an array, cyclically rotate the array clockwise by one time.
Sort an array of 0s, 1s and 2s
Given an array arr[] consisting of only 0s, 1s, and 2s. Sort the array, i.e., put all 0s first, then all 1s and all 2s in last.
Given an array of integers arr, sort the array without using any built-in functions.