Micro Focus Interview Question

An array consists of only ones and zeros,sort the array in efficient way.

Interview Answer

Anonymous

Oct 30, 2018

Count the number of 0's in the array ( that's O(n) ), then rewrite the array with the number of 0's at the beginning and the rest 1's ( O(n) ).