The source code is in search.py
file.
To install dependecies you should use poetry.
poetry -V
Poetry version 1.1.14
poetry install
Project now is available to run and can be used.
Command that runs type checking.
mypy search.py
Command that runs tests.
python search_test.py
I decided to solve the task using just loops. The algorythm has O(n^2)
running time.
To make it more efficient it better to use trees + add performance checkups.