Randomized Problems
Master randomized problems with AI-powered solutions. Get instant coding assistance during your technical interviews for all 12 problems in this category.
Total Problems: 12
Medium: 9
Hard: 3
Showing 12 of 12 problems
Problems
Scroll within this area to browse all problems
#
Title
Difficulty
Randomized LeetCode Problems List
- 912. Random Pick with Weight - Medium - RandomizedYou are given a 0-indexed array of positive integers w where w[i] describes the weight of the ith index. You need to implement the function pickIndex(... Topics: Array, Math, Binary Search, Prefix Sum, Randomized
- 380. Insert Delete GetRandom O(1) - Medium - RandomizedImplement the RandomizedSet class: RandomizedSet() Initializes the RandomizedSet object. bool insert(int val) Inserts an item val into the set if not ... Topics: Array, Hash Table, Math, Design, Randomized
- 398. Random Pick Index - Medium - RandomizedGiven an integer array nums with possible duplicates, randomly output the index of a given target number. You can assume that the given target number ... Topics: Hash Table, Math, Reservoir Sampling, Randomized
- 384. Shuffle an Array - Medium - RandomizedGiven an integer array nums, design an algorithm to randomly shuffle the array. All permutations of the array should be equally likely as a result of ... Topics: Array, Math, Design, Randomized
- 381. Insert Delete GetRandom O(1) - Duplicates allowed - Hard - RandomizedRandomizedCollection is a data structure that contains a collection of numbers, possibly duplicates (i.e., a multiset). It should support inserting an... Topics: Array, Hash Table, Math, Design, Randomized
- 913. Random Flip Matrix - Medium - RandomizedThere is an m x n binary grid matrix with all the values set 0 initially. Design an algorithm to randomly pick an index (i, j) where matrix[i][j] == 0... Topics: Hash Table, Math, Reservoir Sampling, Randomized
- 894. Random Pick with Blacklist - Hard - RandomizedYou are given an integer n and an array of unique integers blacklist. Design an algorithm to pick a random integer in the range [0, n - 1] that is not... Topics: Array, Hash Table, Math, Binary Search, Sorting, Randomized
- 915. Generate Random Point in a Circle - Medium - RandomizedGiven the radius and the position of the center of a circle, implement the function randPoint which generates a uniform random point inside the circle... Topics: Math, Geometry, Rejection Sampling, Randomized
- 1638. Best Position for a Service Centre - Hard - RandomizedA delivery company wants to build a new service center in a new city. The company knows the positions of all the customers in this city on a 2D-Map an... Topics: Array, Math, Geometry, Randomized
- 914. Random Point in Non-overlapping Rectangles - Medium - RandomizedYou are given an array of non-overlapping axis-aligned rectangles rects where rects[i] = [ai, bi, xi, yi] indicates that (ai, bi) is the bottom-left c... Topics: Array, Math, Binary Search, Reservoir Sampling, Prefix Sum, Ordered Set, Randomized
- 382. Linked List Random Node - Medium - RandomizedGiven a singly linked list, return a random node's value from the linked list. Each node must have the same probability of being chosen. Implement the... Topics: Linked List, Math, Reservoir Sampling, Randomized
- 903. Implement Rand10() Using Rand7() - Medium - RandomizedGiven the API rand7() that generates a uniform random integer in the range [1, 7], write a function rand10() that generates a uniform random integer i... Topics: Math, Rejection Sampling, Randomized, Probability and Statistics
Related LeetCode Topics
- Array LeetCode Problems
- Backtracking LeetCode Problems
- Biconnected Component LeetCode Problems
- Binary Indexed Tree LeetCode Problems
- Binary Search LeetCode Problems
- Binary Search Tree LeetCode Problems
- Binary Tree LeetCode Problems
- Bit Manipulation LeetCode Problems
- Bitmask LeetCode Problems
- Brainteaser LeetCode Problems
- Breadth-First Search LeetCode Problems
- Bucket Sort LeetCode Problems
- Combinatorics LeetCode Problems
- Concurrency LeetCode Problems
- Counting LeetCode Problems
- Counting Sort LeetCode Problems
- Data Stream LeetCode Problems
- Database LeetCode Problems
- Depth-First Search LeetCode Problems
- Design LeetCode Problems