Interview Query

Nightly Job

Have you seen this question before?

Every night between 7 pm and midnight, two computing jobs from two different sources are randomly started with each one lasting an hour.

Unfortunately, when the jobs simultaneously run, they cause a failure in some of the company’s other nightly jobs, resulting in downtime for the company that costs $1000\$1000

The CEO, who has enough time today to hear one word, needs a single number representing the annual (365 days) cost of this problem.

Note: Write a function to simulate this problem and output an estimated cost. 

Bonus - How would you solve this using probability?



n = 4


simulate_overlap(n) -> 0.4
Next question: Second Longest Flight
Python 3.9.6
Loading editor
Use Shift + Enter to run code