Skip to content

Commit 2631fd9

Browse files
committed
Improved task
1 parent f74a38c commit 2631fd9

File tree

1 file changed

+1
-3
lines changed
  • src/main/java/g3201_3300/s3213_construct_string_with_minimum_cost

1 file changed

+1
-3
lines changed

src/main/java/g3201_3300/s3213_construct_string_with_minimum_cost/Solution.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,9 +86,7 @@ public int minimumCost(String target, String[] words, int[] costs) {
8686
dp[0] = 0;
8787
ACAutomaton.Node node = root;
8888
for (int i = 1; i < dp.length; i++) {
89-
if (node != null) {
90-
node = ac.go(node, target.charAt(i - 1));
91-
}
89+
node = ac.go(node, target.charAt(i - 1));
9290
for (ACAutomaton.Node temp = node;
9391
temp != null && temp != root;
9492
temp = ac.getOutput(temp)) {

0 commit comments

Comments
 (0)