Minimum Steps Required

Problem Overview

  • Determine the minimum steps to transform one binary string into another by reversing substrings of length 2, then 3, repeating this pattern.
  • Input: str1 and str2 of 0s and 1s (length 2–30); Output: minimum steps needed or -1 if impossible.
  • Steps must be applied in strict order without skipping, and each reversal must change the string.
  • Domain: string manipulation on binary data; a coding interview problem and interview question from Barclay interviews.

Example

Unlock to view complete problem details

and practice with sample input/output

Was this article helpful?

View Test Cases & Run Code requires membership

Input Variables
Execution Result: