0 0 1 1 2 2 1 1 0 1 2 2 1 1 0
Here is a cut of the islands on that path:
       /***\       /*\         <-- 2 meters above the see level
   /***********\ /*******\     <-- 1 meter above the see level
***************************    <-- see level
| | | | | | | | | | | | | |
0 0 1 1 2 2 1 1 0 1 2 1 1 0    <-- altitude on each point
This example is constituted of four levels of island:
This can also be visualized this way:
0 0(1 1(2 2)1 1)0(1(2)1 1)0
Could you write a little program to compute the amount of levels in a given sequence of altitudes? Actually, there is an iterative and a recursive solution to that problem.