Skip to content

Commit bb5cdc5

Browse files
committed
refactor: add minor optimization improvement to day 7
1 parent 0cb6c2b commit bb5cdc5

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/main/java/com/adventofcode/flashk/day07/Equation.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ private boolean hasSolution(long partialResult) {
3030

3131
if(operators.isEmpty()) {
3232
return partialResult == result;
33+
} else if(partialResult > result) {
34+
return false;
3335
}
3436

3537
Integer currentOperator = operators.poll();

0 commit comments

Comments
 (0)