Skip to content

Latest commit

 

History

History

Segregate 0s and 1s

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

You are given an array of 0s and 1s in random order. Segregate 0s on left side and 1s on right side of the array. Traverse array only once.

Input array   =  [0, 1, 0, 1, 0, 0, 1, 1, 1, 0] 
Output array =  [0, 0, 0, 0, 0, 1, 1, 1, 1, 1]