is a comprehensive book on getting a job at a top tech company, while focuses on dev interviews and does this for PMs.
CareerCup's interview videos give you a real-life look at technical interviews. In these unscripted videos, watch how other candidates handle tough questions and how the interviewer thinks about their performance.
Most engineers make critical mistakes on their resumes -- we can fix your resume with our custom resume review service. And, we use fellow engineers as our resume reviewers, so you can be sure that we "get" what you're saying.
Our Mock Interviews will be conducted "in character" just like a real interview, and can focus on whatever topics you want. All our interviewers have worked for Microsoft, Google or Amazon, you know you'll get a true-to-life experience.
The idea is to create a prob. distribution out of the given prob. density and then choose the random numbers out of it.
Here is the example. For a given Prod. density, say Den = [1,2,4,5,1,3], the distribution is cumulative sum of the array. So, Dist = [1,3,7,12,13,16].
Now, generate a uniform random number between 0 and Dist[n] = 16. The number to be returned is the index of whichever interval the generate random number fell into. Lets say, we generated 10. 10 lies in [7,12], so the return value is index(12) = 3.
Here is a sample code:
PS: My apologies if this solution has already been proposed. I could not understand some of the code in the comment section - my bad.
- ekalavya April 12, 2013