For the fourth solution:
Wouldn't substring take linear time to calculate therefore making the whole algorithm run in time proportional to n^3?
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.
Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.