Leetcode - Insert Delete GetRandom O(1) (Python)

preview_player
Показать описание
June 2020 Leetcode Challenge
Leetcode - Insert Delete GetRandom O(1)
Рекомендации по теме
Комментарии
Автор

Wait, does it work in O(1) time? You get keys from dict, is it O(1)? I guess, this operation takes a lot longer time, like O(n) and it's bad solution for task about O(1) time complexity for all operations. Am i wrong?

eduardsukhavenka
Автор

Would this be accepted in an interview?

edwardteach
Автор

Hi sir,
please explain what is meant by self.items[val] = True in insert function

midhileshmomidi
visit shbcf.ru