I got this question in an interview and I was not able to solve it.
You have a circular road, with N number of gas stations. You know the ammount of gas
One easy way of solving this is using a brute force method. i.e. try every posibility and throw out ones that don't work.
i.e. Start at each gas station in turn (repeat below for each starting station).
(gas >= gasToMoveToNextStationNeeded)
Edit As per @Vash's answer, As an improvement when deciding where to start, discount stations that don't have enough gas themselves to get to the next station and working through starting stations in order of amount of gas (descending).
Note, this assumes we visit all gas stations. Will need refinement for skipping gas stations if you need an optimal solution (question doesn't specify this).