From 2c13518a30727c8c8865f6b97e1947e85ea7ed97 Mon Sep 17 00:00:00 2001 From: rpidanny Date: Sat, 7 Dec 2024 11:54:34 +0100 Subject: [PATCH] feat(2024): optimize day 7 - Bridge Repair --- 2024/Day07/bridge_repair.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/2024/Day07/bridge_repair.py b/2024/Day07/bridge_repair.py index 2569304..091da42 100644 --- a/2024/Day07/bridge_repair.py +++ b/2024/Day07/bridge_repair.py @@ -12,6 +12,8 @@ def is_valid_equation( result: int, concat: bool, ) -> bool: + if result > equation[0]: + return False if idx >= len(equation[1]): return equation[0] == result next_val = equation[1][idx]