Need help in this problem || Can we do it without DP ?

Revision en1, by returnA, 2023-06-22 15:06:54

Given two strings A and B(binary string) of size n, and an Integer K. Two types of operation available-

  1. Choose two indices i and j, flip both A[i], A[j]. Cost of this is K.

  2. Choose any adjacent pairs(A[i], A[i+1]) and flip both. Cost is 1.

Minimum no of operation to convert A to B. If not possible print Not possible.

Tags dp, string

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en2 English returnA 2023-06-22 22:23:35 3 Tiny change: 'Integer K.\nTwo type' -> 'Integer K. \nTwo type'
en1 English returnA 2023-06-22 15:06:54 396 Initial revision (published)