Determine whether a car can get around a route with a limited amount of gas Using any programming language that supports functions, have the function

is_enough(strArr) 


that take strArr which will be an an array consisting of the following elements: 


N which will be the number of gas stations in a circular route 
and each subsequent element will be the string g:c where 

g is the amount of gas in gallons at that gas station and 
c will be the amount of gallons of gas needed to get to the following gas station. 



For example strArr may be: 

["4","3:1","2:2","1:2","0:1"]. 


Your goal is to return the index of the starting gas station that will allow you to travel around the whole route once, otherwise return the string "impossible".

For the example above there are 4 gas stations, and your program should return the string "1" because:


Starting at station 1 you receive 3 gallons of gas and spend 1 getting to the next station.
Then you have 2 gallons + 2 more at the next station and you spend 2 so you have 2 gallons when you get to the 3rd station.
You then have 3 but you spend 2 getting to the final station, 
At the final station you receive 0 gallons and you spend your final gallon getting to your starting point. 


Starting at any other gas station would make getting around the route impossible, so the answer is "1". 

If there are multiple gas stations that are possible to start at, return the smallest index (of the gas station). N will be &gt;= 2. 

Correct Sample Outputs:

Input: ["4","1:1","2:2","1:2","0:1"]
Output: "impossible"

Input: ["4","0:1","2:2","1:2","3:1"]
Output: "4"


The winner will be the one to use the shortest code although it will be long.
Bash 178 170 161 157
Rather straight forward.
is_enough(){((t=(n=$1-1)&lt;0))&amp;&amp;echo impossible||(x=(n ${@:3} $2);for z in ${@:2};do(((t+=${z%:*}-${z#*:})&lt;0))&amp;&amp;is_enough ${x[*]}&amp;&amp;return;done;echo $[$#-++n])}

Spaced out:
is_enough() {
     ((t=(n=$1-1)&lt;0)) &amp;&amp; echo impossible || (
         x=(n ${@:3} $2);
         for z in ${@:2};do
             (((t+=${z%:*}-${z#*:})&lt;0)) &amp;&amp; is_enough ${x[*]} &amp;&amp; return;
         done;
         echo $[$#-++n]
     )
}