</>OfferRetriever
DashboardDiscuss
NEW

Halloween Sale

Unlock all premium questions for over 30% off

$10.42$7.08/mo

--

:

--

:

--

:

--

Get this deal
Back to Microsoft Questions

Minimum Adjacent Swaps for Ball Grouping

Medium

Question

A row of colored balls is written as a string balls, one character per ball: 'R' stands for a red ball and 'W' for a white one. A single move exchanges two balls that sit next to each other, and no other kind of move is allowed. Find the fewest moves needed so that every red ball ends up in one unbroken block. If the red balls already form such a block, the answer is 0. ...

Asked at:Microsoft

More Microsoft interview questions

All Microsoft interview questions
OfferRetriever

Master technical interviews with real questions from top companies. Build your confidence and career.

PRODUCT
PricingDashboardDiscussOfferRetriever vs LeetCodeCompare
LEGAL

© 2026 Purple Business Holdings LLC. All rights reserved. See Terms of Service.