Rubrik OA Question: Minimum Swaps to Make Binary String Palindrome
Question Details
Hi everyone, I recently got this question in an OA (Rubrik): Given a binary string s consisting of only '0' and '1', find the minimum number of swaps (swap any two characters, not necessarily adjacent
Full Details
Hi everyone, I recently got this question in an OA (Rubrik): Given a binary string s consisting of only '0' and '1', find the minimum number of swaps (swap any two characters, not necessarily adjacent) required to make the string a palindrome. If it is impossible,
return -1.
Example:
Input: s = "101000"
Output: 1 (swap the chars at position '2' & position '5') Can anyone please share the exact question link for practice if they have it handy? or best - if you have solution, please post this question to leetcode.
About This Question
This is a reported interview question from a rubrik interview for a swe role during the oa round reported in 2026.
It covers the following topics: Strings .