Subj : Re: Arranging the keys problem To : comp.programming From : Mitja Trampus Date : Thu Sep 29 2005 11:38 pm mihir wrote: > There are n keys of different 3 colors say white ,red and blue only.Now > we have to arrange keys such that red keys come before white ones and > white ones come before blue keys eg RWWBBB where the keys are placed in > any random order.Give me a linear time algorithm to solve this problem > ( O(n)). "Give me a linear time algorithm." I just love the subtleness of this request formulation :) Hint: count the number of keys of each color. .