Search⌘ K

DIY: Random Pick Index

Explore how to build a memory-efficient solution in Go to randomly pick an index of a target number from an array with duplicates. Understand the problem constraints and develop code to handle large input efficiently.

Problem statement

In this challenge, you are given an array of integers with possible duplicate values. Your task is to output a randomly picked index of a given target number present in the array. The solution ...