give array num n object color red white blue sort inplace object color adjacent color order red white blueWe use integer 0 1 2 represent color red white blue respectivelyyou solve problem library sort function Example 1input num 202110output 001122example 2input num 201output 012 Constraintsn numslength1 n 300numsi 0 1 2 follow could come onepass algorithm constant extra space