← Morgan Stanley questions

Segregate R, G, B flags

Filed under Morgan Stanley

Given an array containing only characters 'R', 'G', and 'B', segregate them in-place such that all 'R's come first, followed by 'G's, and 'B's last, using O(n) time and constraint of restricted extra…

You've read your 3 free write-ups

Sign up free to keep reading. Your account opens the first 10 questions of every company.

Related Morgan Stanley questions

Collected from public candidate posts and coding forums. Updated Nov 2026.