Bird
Raised Fist0
HLDsystem_design~10 mins

Design a key-value store in HLD - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to define the main component of a key-value store system.

HLD
class [1]Store:
    def __init__(self):
        self.store = {}
Drag options to blanks, or click blank then click option'
ACache
BDatabase
CKeyValue
DFile
Attempts:
3 left
💡 Hint
Common Mistakes
Using generic names like Database or Cache which are broader concepts.
2fill in blank
medium

Complete the code to add a method that stores a value by key.

HLD
def put(self, [1], value):
    self.store[key] = value
Drag options to blanks, or click blank then click option'
Adata
Bitem
Cvalue
Dkey
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'item' or 'data' which do not match the internal usage.
3fill in blank
hard

Fix the error in the method that retrieves a value by key.

HLD
def get(self, [1]):
    return self.store.get(key, None)
Drag options to blanks, or click blank then click option'
Akey
Bvalue
Citem
Ddata
Attempts:
3 left
💡 Hint
Common Mistakes
Using parameter names that do not match the variable used inside the method.
4fill in blank
hard

Fill both blanks to implement a method that deletes a key-value pair safely.

HLD
def delete(self, [1]):
    if [2] in self.store:
        del self.store[key]
Drag options to blanks, or click blank then click option'
Akey
Bvalue
Ditem
Attempts:
3 left
💡 Hint
Common Mistakes
Using different variable names causing errors or undefined variables.
5fill in blank
hard

Fill all three blanks to implement a method that returns all keys with values greater than a threshold.

HLD
def keys_above(self, [1]):
    return [k for k, v in self.store.items() if v [2] [3]]
Drag options to blanks, or click blank then click option'
Athreshold
B>
D<
Attempts:
3 left
💡 Hint
Common Mistakes
Using wrong comparison operators or mismatched variable names.