Pre-requisites: sorting, basic mathematics
Given a list, d consisting of the distances of each zombie from chef and each zombie is approaching chef at one unit per second you are required to find if chef would be able to survive if he shoots one zombie per second and reloads after every six seconds(which takes one second).
Let us consider chef to be at a reference point 0 and the zombies at points mentioned in the list d. After every second the zombies move one unit close to chef. For each second decrement one from each of the element of the list d or increment the position of chef. At any point of time if the position of chef is equal to that of any of the zombies, then chef would not be able to survive, else he would.
Problem setter’s solution: SOLUTION