Пожалуйста, прочтите новое правило об ограничении использования AI-инструментов. ×

How to solve this problem (Interview Question) ?

Правка en1, от learner_321, 2018-03-18 07:27:23

You are given to Strings , in one String you can swap any adjacent character , also you can swap first and last character . Find the minimum number of swaps required to make two String similar.

Sample Ip —

S1- aab S2- baa

Op — 1

You can swap first and last character of S2 , so ans will be 1.

How to solve this ?

Constraints were 1<=|S1|, |S2| <= 2000.

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en1 Английский learner_321 2018-03-18 07:27:23 436 Initial revision (published)