Necklace Cut into Two Halves with Equal D/R Counts

Asked at Google · Coding Questions · Difficulty: Medium · Last asked May 3, 2026

A necklace is a circular string made only of the letters `D` and `R`, with exactly as many `D` as `R`. Cutting the circle at two different positions splits it into two arcs. Find two cut positions so that each arc contains the same number of `D` as `R`.

Loading the problem…