A TV show is considered "addictive" if viewers who start watching episode 1 are very likely to finish the entire 10-episode season. You are given an array dropOff of length 10 where dropOff[i] (0-indexed) is the fraction of users who, having reached episode i+1, abandon the show before watching episode i+2. For example, dropOff[0] is the fraction of users who drop off between episode 1 and episode 2. No users drop off after episode 10.
Your task is to implement a function that returns the earliest episode (1 through 10) such that the probability a user who has just finished that episode will go on to finish episode 10 is at least a given threshold p. If no episode satisfies this requirement, return -1.
The completion probability from episode k is the product of the retention rates (1 - dropOff[i]) for i from k-1 to 8.