Leetcode Sort Colors (array of 0s 1s and 2s)

preview_player
Показать описание
A very common Google, Amazon,Facebook, Microsoft Phone screen coding interview problem.
**************************************************************************************************
Sort Colors problem :
Given an integer array which consists of 0s,1s, and 2s only (they are repeated and not in any order)
Where 0- red, 1- green, 2-Blue
Output : Sort the array in-place (without using counting sort and in linear time or O(n))
*******************************************************************************************************

#google #amazon #facebook #microsoft #codinginterview
Рекомендации по теме
Комментарии
Автор

thanks for the video. why the names 'r' and 'm'? are they arbitrary?

oliverpecha
Автор

using the normal bubble sort technique we can solve it, why is there a special algorithm for this ? Am i missing something ? Just to solve it in O(n) ?

vinothjagannathan
join shbcf.ru