Skip to content

Commit 2712f8f

Browse files
committed
Fix
1 parent da72bbc commit 2712f8f

File tree

2 files changed

+3
-9
lines changed

2 files changed

+3
-9
lines changed

src/main/java/com/thealgorithms/dynamicprogramming/AllConstruct.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,7 @@ public static List<List<String>> allConstruct(String target, List<String> wordBa
3939
for (int i = 0; i <= target.length(); i++) {
4040
if (!table.get(i).isEmpty()) {
4141
for (String word : wordBank) {
42-
if (i + word.length() <= target.length() &&
43-
target.substring(i, i + word.length()).equals(word)) {
42+
if (i + word.length() <= target.length() && target.substring(i, i + word.length()).equals(word)) {
4443

4544
List<List<String>> newCombinations = new ArrayList<>();
4645
for (List<String> combination : table.get(i)) {

src/test/java/com/thealgorithms/dynamicprogramming/AllConstructTest.java

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,19 +10,14 @@ public class AllConstructTest {
1010

1111
@Test
1212
public void testAllConstructBasic() {
13-
List<List<String>> expected = Arrays.asList(
14-
Arrays.asList("he", "l", "l", "o")
15-
);
13+
List<List<String>> expected = Arrays.asList(Arrays.asList("he", "l", "l", "o"));
1614
List<List<String>> result = AllConstruct.allConstruct("hello", Arrays.asList("he", "l", "o"));
1715
assertEquals(expected, result);
1816
}
1917

2018
@Test
2119
public void testAllConstructMultipleWays() {
22-
List<List<String>> expected = Arrays.asList(
23-
Arrays.asList("purp", "le"),
24-
Arrays.asList("p", "ur", "p", "le")
25-
);
20+
List<List<String>> expected = Arrays.asList(Arrays.asList("purp", "le"), Arrays.asList("p", "ur", "p", "le"));
2621
List<List<String>> result = AllConstruct.allConstruct("purple", Arrays.asList("purp", "p", "ur", "le", "purpl"));
2722
assertEquals(expected, result);
2823
}

0 commit comments

Comments
 (0)