dimanche 18 octobre 2020

Random number generator hackerank

I recently started preparing for interview and I found a very difficult problem on Hackerank that I couldn't solve. here's the link to the problem: https://www.hackerrank.com/challenges/random-number-generator-1/problem When I checked the editorial I didn't understand the first point which state that: the expected score is given by $\sum_{i=1}^{N} i \cdot p_{i} \cdot (1-p_{i})$ where $p_{i}$ is the the probability of getting integer $i$ . Do someone have a better solution using intuition ?




Aucun commentaire:

Enregistrer un commentaire