Search
⌘K

Leetcode 2896. Apply Operations to Make Two Strings Equal

Given two binary strings, minimize the cost to make s1 equal to s2 using operations that flip any two bits at cost x or two adjacent bits at cost 1. Because every operation flips two positions, the parity of mismatches must be even, and the core challenge is optimally pairing mismatched indices (via greedy/DP) to decide when to use adjacent fixes versus distant swaps.


Question Timeline

See when this question was last asked and where, including any notes left by other candidates.

Comments

Your account is free and you can post anonymously if you choose.