← All problemsSign in

2546. Apply Bitwise Operations to Make Strings Equal

LeetCodeStringBit ManipulationOpen on judge ↗

You are given two 0-indexed binary strings s and target of the same length n. You can do the following operation on s any number of times: - Choose two different indices i and j where 0 <= i, j < n. - Simultaneously, replace s[i] with (s[i] OR s[j]) and s[j] with (s[i] XOR s[j]). For example, if s = "0110", you can choose i = 0 and j = 2, then simultaneously replace s[0] with (s[0] OR s[2] = 0

HINT LADDERno hints yet
L1 Observation
L2 Technique
L3 Approach
L4 Pseudo-code
🔒
L5 Full solution
L5 unlocks only if you insist twice
solution.cppC++17

CodeSearch Tutor

Hints, not spoilers — it won’t hand over the full solution unless you insist.

voice by Sarvam AI

Sign in to chat with the tutor and save your progress.

Sign in to start