Skip to content
Closed

Hashmap #14461

Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions hashmap/hashmap.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
class HashMap:

Check failure on line 1 in hashmap/hashmap.py

View workflow job for this annotation

GitHub Actions / ruff

ruff (INP001)

hashmap/hashmap.py:1:1: INP001 File `hashmap/hashmap.py` is part of an implicit namespace package. Add an `__init__.py`.

Check failure on line 1 in hashmap/hashmap.py

View workflow job for this annotation

GitHub Actions / ruff

ruff (INP001)

hashmap/hashmap.py:1:1: INP001 File `hashmap/hashmap.py` is part of an implicit namespace package. Add an `__init__.py`.
def __init__(self):
self.map = {}

def put(self, key, value):
self.map[key] = value

def get(self, key):
return self.map.get(key, None)

def remove(self, key):
if key in self.map:
del self.map[key]

Check failure on line 13 in hashmap/hashmap.py

View workflow job for this annotation

GitHub Actions / ruff

ruff (W292)

hashmap/hashmap.py:13:30: W292 No newline at end of file help: Add trailing newline

Check failure on line 13 in hashmap/hashmap.py

View workflow job for this annotation

GitHub Actions / ruff

ruff (W292)

hashmap/hashmap.py:13:30: W292 No newline at end of file help: Add trailing newline
Loading