One of the reasons I prefer Leetcode to other coding sites is that the questions are presented in a straightforward way, if it's about trees or arrays then that is what is asked in the question. Unfortunately that is not the case here and the real logic is dressed up with a story about Teemo and Ashe (which I have never heard of). I would prefer to get straight to the point and for the title of the question to convey some meaning about what it is about.
However, the underlying problem is simple, I would not say this was "medium"
def findPosisonedDuration(self, timeSeries, duration): if not timeSeries: return 0 poisoned = duration for i in range(1, len(timeSeries)): poisoned += duration - max(0, timeSeries[i-1]+duration - timeSeries[i]) return poisoned
Thanks for suggesting, we'll try to make our question as simple as possible in the next contests.
But here is the reason why we add some story to this question:
First, this question is a contest one, we try to add more fun into the contest.
Second, this question is a real interview question asked by <Riot Game>, all the names and stories in the question are mentioned by the interviewer.
Third, I think it's a very important ability to turn a real-application problem into a problem can be solved by your familiar algorithm for a software engineer, and that's what we want to help our users to develop.
Here are some links about this problem's story:
I agree with @love_FDU_llp , it's very helpful to be able to decipher what is really being asked in an interview. Many times interviewers will create a story to go with the questions that they give, and being able to quickly identify the core problem will not only give you more time to do the implementation, but will also score you some points with the interviewer.
I simply skipped this problem because the story is too long. I think a good interview problem could be either straightforward or vague but must be short. Spending a lot of time explaining to interviewee and making them fully understood probably take a lot of time.
Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.