Rumor has it that Russians don't obey speed limits. That may be because
the speed limits are sometimes specified implicitly in Russia.
More specifically, every road in a city has a default speed
limit of 60 kilometers per hour, and usually doesn't have any road
signs to remind drivers of that. Analogously, every road outside the city
has a default speed limit of 90 kilometers per hour.
The speed limit can still be specified with
road signs, like '30' or '95'. There is also a special road sign,
'start of default speed limit zone', that tells you that the default speed limit is now in place. The signs are sometimes also used to remind
drivers of the current speed limit, so you can meet several same signs in a row.
To summarize, one should pay attention to the following road signs
to monitor the speed limit changes:
- Speed limit X - marks the start of a zone with speed limit X kilometers per hour.
- Start of default speed limit zone - marks the start of a zone with the default speed limit, either 60 if inside a city or 90 if outside.
- City boundary - means the default speed limit changes from 60 to 90 or vice versa. If
you are inside a special speed limit zone, this zone also ends, so the speed limit always becomes equal to the new default.
Given the list of road signs you met on your way as a String[] signs
(in the order you met them), return the current speed limit. Each element of
signs will be either a positive integer number X without leading zeros,
denoting the sign 'Speed limit X', a string "default" denoting the
sign 'start of default speed limit zone', or a string "city", denoting the sign
'city boundary' (quotes for clarity only). You start your journey inside a city, and outside any special speed
limit zone.
|