File tree Expand file tree Collapse file tree 2 files changed +9
-7
lines changed
main/java/by/andd3dfx/string
test/java/by/andd3dfx/string Expand file tree Collapse file tree 2 files changed +9
-7
lines changed Original file line number Diff line number Diff line change 66
77/**
88 * <pre>
9- * Написать метод (класс и импорты не нужны) на вход которого приходит две строки.
10- * На выходе надо проверить можно ли получить одну строку из другой за 1 исправление:
9+ * <a href="https://leetcode.com/problems/one-edit-distance/description/">Task description</a>
10+ *
11+ * Написать метод, на вход которого приходит две строки.
12+ * На выходе надо проверить, можно ли получить одну строку из другой за 1 исправление:
1113 * - замена одного символа в одной строке
1214 * - вставка/удаление одного символа из одной строки
1315 *
2224 * @see <a href="https://youtu.be/GOSWr4jHng8">Video solution</a>
2325 * @see <a href="https://youtu.be/0543ZryeIx4">Video solution 2</a>
2426 */
25- public class StringTransformation {
27+ public class OneEditDistance {
2628
2729 public static boolean couldTransform (String first , String second ) {
2830 char [] s1 = first .toCharArray ();
Original file line number Diff line number Diff line change 22
33import org .junit .Test ;
44
5- import static by .andd3dfx .string .StringTransformation .couldTransform ;
6- import static by .andd3dfx .string .StringTransformation .couldTransformUsingLevenshteinDistance ;
5+ import static by .andd3dfx .string .OneEditDistance .couldTransform ;
6+ import static by .andd3dfx .string .OneEditDistance .couldTransformUsingLevenshteinDistance ;
77import static org .assertj .core .api .Assertions .assertThat ;
88
9- public class StringTransformationTest {
9+ public class OneEditDistanceTest {
1010
1111 @ Test
1212 public void couldTransform_changeOneChar () {
@@ -60,4 +60,4 @@ public void couldTransform_transformIsNotPossible() {
6060 assertThat (couldTransformUsingLevenshteinDistance ("abcde" , "abdm" )).isFalse (); // different lengths
6161 assertThat (couldTransformUsingLevenshteinDistance ("abdm" , "abcde" )).isFalse (); // different lengths
6262 }
63- }
63+ }
You can’t perform that action at this time.
0 commit comments