← 返回 meta 的题目列表In-Memory Record Store: Add/Remove and Query by Exact Key/Prefix
类型:online_judge
Problem: In-Memory Record Store (Leveled)
Implement an in-memory record store (using a dictionary/map) by completing a set of functions. The assessment is split into multiple levels, where each next level builds on the previous one.
Level 1: Add and Remove
Implement two functions (names/signatures follow the provided template):
add_record(...): add/write a record into the store.
remove_record(...): delete a record from the store.
Note: the record schema (what a record contains, and what is used as the key) is defined by the prompt/template.
Level 2: Query by Exact Key and Key Prefix
Based on Level 1, implement two more functions:
scan_by_matching_key(...): scan the dictionary and return records whose key exactly matches the provided key (or matches per the prompt’s “matching key” definition).
scan_by_key_prefix(...): scan the dictionary and return records whose keys start with the provided prefix.
Requirements
Implement the functions in the given framework.
Your solution must pass both visible and hidden test cases.
Constraints
Operation count, key length, number of records, etc. are as specified in the OA prompt (not included in the shared post).
Examples
No concrete I/O examples were provided in the post; follow the OA harness and examples in the prompt.