Since the question says it focusing on memory, we discard the solution according to `Map`

. And since it has not been sorted, binary search does not work here.

```
public int pick(int target) {
int count = 0, index = -1;
for(int i = 0; i<n.length; i++){
if(n[i] == target&&Math.random()*(++count)<1.0) index = i;
}
return index;
}
```