When submitting a solution in C++, please select either C++14 (GCC 6-32) or C++17 (GCC 7-32) as your compiler. ×

aya1909's blog

By aya1909, history, 3 years ago, In English

Given two binary strings of equal length (eg. "10101" and "10010") we had to find whether we can convert string 1 to string 2 by performing following operations:

reverse substring of length 2 reverse substring of length 2 reverse substring of length 2

  • Vote: I like it
  • 0
  • Vote: I do not like it

»
3 years ago, # |
  Vote: I like it +1 Vote: I do not like it

Do we have to perform "reverse substring of length 2" 3 times? By the way string 1 has 3 one and string 2 has 2 one. So it is impossible to convert it by only reversing. PS: It would be better if you can provide the problem link.