Fast Set-All Data Structure Design a data structure that supports the following operations in O(1) time: Constructor(initial_data: List[int]) Initialize the structure with an existing list of integers. Try to avoid copying the entire list if possible. get(index: int) -> int Return the value at the given index. Must run in O(1) time. set(index: int, value: int) -> None Update the value at the given index. Must run in O(1) time. set_all(value: int) -> None Set all elements in the structure to the given value. Must run in O(1) time.
Check out your Company Bowl for anonymous work chats.