Finoit Interview Question

Find maximum occurring elements in a sorted and unsorted array using single loop and some constraints