I have been trying to solve question Cops and the Thief Devu. At first I realized that I understand what the question need to tell but when I went through the sample example and its explanation, it makes me confused and puzzled.
Here I’d like to highlight key points of the question
Cops run at a maximum speed of x houses per minute in a straight line.
Cops will search for a maximum of y minutes
This way if the input will be
4 7 8
12 52 56 8
Then cops can cover the house from 12 to 68 (12 +(7x8)) not from 1 to 68 because the cop is at 12 house and if he start moving in a straight line then he can inspect only 56 (7*8) houses from its current house i.e. 12 (correct me if my calculation is wrong or I’m missing something)
Lets take another example
2 10 2
Like stated above, cops can cover the house from 21 to 41 (21 +(10x2)) not from 1 to 41
Any idea what I missed?
~Thanks in advance