Created
February 26, 2024 13:38
-
-
Save zolotyh/a64f0c040119e139e2f793c0f235de88 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** Необходимо реализовать функцию singleChange(str1, str2) -> boolean, которая проверяет, можно ли две переданные на вход строки сделать идентичными за 1 изменение | |
* (добавление / удаление / замену 1 символа) в любом месте строки. | |
* Можно не задумываться об оптимальности, просто хочется увидеть продакшен-решение. | |
Optional: юнит-тесты | |
Optional: оптимальное решение | |
* Например: | |
* singleChange('aa_a', 'ab_a') -> true (b заменяем на a) | |
* singleChange('cat', 'catt') -> true (добавляем t) | |
* singleChange('dog', 'dlog') -> true (добавляем l) | |
* singleChange('horse', 'hors') -> true (удаляем e) | |
* singleChange('abc', 'bcde') -> false | |
*/ | |
function singleChange(str1: string, str2: string): boolean { | |
return true | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment