Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 

README.md

Random Pick Index (Medium 398)

Given an array of integers with possible duplicates, randomly output the index of a given target number. You can assume that the given target number must exist in the array.

Solution:

Click here Multiple memory and speed solutions. Use hash table to save target:[indices]. Return random index from array. O(n) time, O(n) space.



Installation

Run make to run python and Swift files.