I have an array of N integers (a[N]). I start removing numbers from the array one by one. If at any point I remove an element a[i] and the sum of the remaining numbers is S, then the happiness increases by an amount of S/a[i]. What is the expected value of the total happiness ?
Initial happiness can be considered as 0.
This is a question from CodeNation Hiring Contest happened on 26th January 2019! You can look at the following blog:- https://codeforces.net/blog/entry/64719. It has a solution for it in the comments.