Find sub-array with 0 sum

Given an array of integers, check if array contains a sub-array having 0 sum. Also, prints end-points of all such sub-arrays.

Read More Find sub-array with 0 sum

Merge two arrays by satisfying given constraints

Given two sorted arrays X[] and Y[] of size m and n each where m >= n and X[] has exactly n vacant cells, merge elements of Y[] in their correct position in array X[] i.e. merge (X, Y) by keeping the sorted order.

Read More Merge two arrays by satisfying given constraints

Inplace merge two sorted arrays

Given two sorted arrays X[] and Y[] of size m and n each, merge elements of X[] with elements of array Y[] by maintaining the sorted order. i.e. fill X[] with first m smallest elements and fill Y[] with remaining elements. The conversion should be done in-place and without using any other data structure.

Read More Inplace merge two sorted arrays

Sort binary array in linear time

Given an binary array, sort it in linear time and constant space. Output should print contain all zeroes followed by all ones.

Read More Sort binary array in linear time

Rearrange the array with alternate high and low elements

Given an array of integers, rearrange the array such that every second element of the array is greater than its left and right elements. Assume no duplicate elements are present in the array.

Read More Rearrange the array with alternate high and low elements