Available question text
Determine whether the counts of 0s and 1s allow an alternating arrangement (they can differ by at most 1), and if so compute the minimum swaps by comparing s to the two possible alternating targets ("0101..." and "1010...") and taking the smaller mismatch-based swap count; return -1 if impossible.
Related questions
Continue with questions that share topics or the same question type.
Sources · 1 reference
These records explain where the question appears. A company tag or candidate report does not guarantee a future interview question.
Hello Interview · 1 record
No company association
Leetcode 1864. Minimum Number of Swaps to Make the Binary String Alternating
Reported date not specified · 0 source reports
Source snapshot: Nov 12, 2026
View source