There is a problem with this questions - we need to know which operation is more common

  • 0

    You can't optimise a data structure for all operations.
    There are usually trade offs between writing and reading speed and here we don't have enough information to choose a data structure.

Log in to reply

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.