## Find Index of Maximum Occurring Element with Equal Probability

Given a collection of integers, develop an algorithm to find the index of maximum occurring element with equal probability. Get great deals at Amazon

Coding made easy

Given a collection of integers, develop an algorithm to find the index of maximum occurring element with equal probability. Get great deals at Amazon

Given an array of integers, check if an array is formed by consecutive integers.

Given an unsorted array of integers, find two non-overlapping pairs in it having same sum.

Given a sequence of numbers such that the difference between the consecutive terms is constant, find missing term in it in O(log(n)) time.

Given an array of integers, find subarrays with given sum in it.

Given a set S, generate all distinct subsets of it i.e., find distinct power set of set S. A power set of any set S is the set of all subsets of S, including the empty set and S itself.

Given a sorted array of integers, find floor and ceil of a given number in it. The floor and ceiling map the given number to the largest previous or the smallest following integer, respectively.

Given an binary array of size two having alteast one element as zero, write a single line function to set both its elements to zero. Use of ternary operator and direct assignment of elements are not allowed.

In k-partition problem, we need to partition an array of positive integers into k disjoint subsets that all have equal sum and they completely covers the set.

3-partition problem: Given a set S of positive integers, determine if it can be partitioned into three disjoint subsets that all have same sum and they cover S.

In this post, we will see how to sort an array of integers using iterative merge sort algorithm.

Given an unsorted array of integers whose each element lies in range 0 to n-1 where n is the size of the array, rearrange array such that A[A[i]] is set to i for every element A[i] in the array. Do this in linear time and without using any extra constant space.