Блог пользователя deepGajera18

Автор deepGajera18, 4 года назад, По-английски

You are given two strings S and T. you need to find the largest common prefix of two strings S and T if we are allowed to swap two characters in one of the strings?

1 <= |S| <= 100000 1 <= |T| <= 100000

example: S = "abcab" and T = "abbac", then answer would be "abcab". (By swapping characters at index 2 and 4 in string T)

Note: you can perform swap operation at most one time either on string S or string T.

Полный текст и комментарии »

  • Проголосовать: нравится
  • +20
  • Проголосовать: не нравится