Showing 3 of 22 questions
Imagine a map where cities are connected by roads. Given a list of roads, find how many separate groups of connected cities (provinces) there are.
#1. Number of Provinces
You're given an array representing weights. Implement a function to randomly pick an index from the array, where the probability of picking each index is proportional to its weight.
#2. Random Pick with Weight
Find the minimum number of operations to reduce a given positive integer to 0. You can either subtract a power of 2 or add a power of 2 in each operation.
#3. Minimum Operations to Reduce an Integer to 0
Page 1 of 1 · 22 total