Array mode update


  • 0
    M

    You are given a positive integer array and a list of update operations as pairs (index, newValue).

    Return a list containing the mode of the array after each update.


  • 0
    H

    Isn't this essentially the All O(1) data structure leetcode question.

    We just need to maintain the original vector of values and the data strucutre which solves for decreasekey(), increasekey() and getmax()

    DO the above for the frequency of numbers as they can get affected by +1, 0 or -1 after every operation


Log in to reply
 

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