Insert Delete GetRandom O(1) (LeetCode 380)The problem Design a with three operations, each in O(1) average time: : add…