Your Dashboard
Interview Coaching
Learn
System Design
ML System Design
Code
Behavioral
Salary Negotiation
Interview Guides
Search
⌘K
Get Premium
Leetcode 1864. Minimum Number of Swaps to Make the Binary String Alternating
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.
Question Timeline
See when this question was last asked and where, including any notes left by other candidates.
All Regions
Comments
Hello Interview Premium
Your account is free and you can post anonymously if you choose.