# 12032 - The Monkey and the Oiled Bamboo

 Tweet
Difficulty : easy

Solution Description :
Simple Calculation

Find the maximum distance from all value (1-0)=1, (6-1)=5, (7-6)=1, (11-7)=3, (13-11)=2 so the maximum value is 5
set k= the maximum value=5

For example, let the height of the rungs from the ground are 1, 6, 7, 11, 13 respectively and k be 5. Now the steps are:

Jumped 1 foot from the ground to the 1st rung (ground to 1). Since I jumped less than k feet, k remains 5.
Jumped 5 feet for the next rung (1 to 6). So, k becomes 4.
Jumped 1 foot for the 3rd rung (6 to 7). So, k remains 4.
Jumped 4 feet for the 4th rung (7 to 11). This k becomes 3.
Jumped 2 feet for the 5th rung (11 to 13). And so, k remains 3.
The process is complete then ans=5

If you can complete the process then print initial k
Otherwise print initial k+1

Another Example
let the height of the rungs from the ground are 2, 8, 11, 16, 21 respectively
distance 2, 6, 3, 5, 5
So the maximum distance is 6, k=6

Jumped 2 foot from the ground to the 1st rung (ground to 1). Since I jumped less than k feet, k remains 6.
Jumped 6 feet for the next rung (2 to 8). Since I jumped equal k feet, k becomes 5.
Jumped 3 foot for the 3rd rung (8 to 11). So, k remains 5.
Jumped 5 feet for the 4th rung (11 to 16). This k becomes 4.
Jumped 5 feet for the 5th rung (16 to 21). This time i need to jump 5 but k is 4 so you can,t complete the process.
Ans = 6+1=7