#3849

Maximum Bitwise XOR After Rearrangement

medium · 70.9% accepted · 42 likes · top 80%

string · greedy · bit manipulation

Description

You are given two binary strings s and t​​​​​​​, each of length n.

You may rearrange the characters of t in any order, but s must remain unchanged.

Return a binary string of length n representing the maximum integer value obtainable by taking the bitwise XOR of s and rearranged t.

Solution