From 7427a23e94d9d7eb6a656a14a105b2500a414d7d Mon Sep 17 00:00:00 2001 From: yashwanth-adimulam <157975817+yashwanth-adimulam@users.noreply.github.com> Date: Fri, 25 Oct 2024 11:57:58 +0530 Subject: [PATCH] Trying to solve pre-commit error of type overload --- data_structures/arrays/dynamic_array.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/data_structures/arrays/dynamic_array.py b/data_structures/arrays/dynamic_array.py index ad4bfb4f9..5c758ad37 100644 --- a/data_structures/arrays/dynamic_array.py +++ b/data_structures/arrays/dynamic_array.py @@ -78,6 +78,11 @@ class DynamicArray: if index < 0 or index >= self.size: raise IndexError("index out of range") return self.array[index] + + def __setitem__(self, index: int, value: int) -> None: + if index < 0 or index >= self.size: + raise IndexError("index out of range") + self.array[index] = value def __len__(self) -> int: """