From 345464d0d4f87f1491cbb58c6f3ff376cb3450f7 Mon Sep 17 00:00:00 2001 From: Dan Buch Date: Fri, 20 Oct 2023 10:51:29 -0400 Subject: [PATCH] Add a guard rail around Roman.i2r --- leetcode/stuff.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/leetcode/stuff.py b/leetcode/stuff.py index 8a04d5d..c6682c1 100644 --- a/leetcode/stuff.py +++ b/leetcode/stuff.py @@ -102,6 +102,9 @@ class Roman: @classmethod def i2r(cls, i: int) -> str: + if i > 100_000: + raise ValueError(f"{i} is too silly") + r: list[str] = [] for int_val, roman_val in sorted(cls.ALL_REVERSE.items(), reverse=True):