2896. Apply Operations to Make Two Strings Equal
You are given two 0-indexed binary strings s1 and s2, both of length n, and a positive integer x. You can perform any of the following operations on the string s1 any number of times: - Choose two indices i and j, and flip both s1[i] and s1[j]. The cost of this operation is x. - Choose an index i such that i < n - 1 and flip both s1[i] and s1[i + 1]. The cost of this operation is 1. Return the
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.
Sign in to chat with the tutor and save your progress.
Sign in to start