+ 4

Challenge 4

A monkey starts climbing up a pole. Each time it jumps 20 cm and then slips by 20%of the previous jump. Write a code to input the height of the pole and calculate how much time a monkey will take to reach to reach the top of the pole, if it takes 1 second to jump up and 0.5 second to slide down.

29th Jun 2017, 8:54 AM
Dragon Slayer Xavier
Dragon Slayer Xavier - avatar
9 Respostas
29th Jun 2017, 10:11 AM
Nomeh Uchenna Gabriel
Nomeh Uchenna Gabriel - avatar
+ 9
Check: 50 cm pole = 20 cm (1s) - 4 cm (0.5s) + 20 cm (1s) - 4 cm (0.5s) + 18 cm (0.9s) = 3.9s. Delete Line 7 if you want 4s as answer for 50 cm. https://code.sololearn.com/Wp8I2vMkggl1/?ref=app
29th Jun 2017, 12:32 PM
Krishna Teja Yeluripati
Krishna Teja Yeluripati - avatar
+ 5
I'm on it
29th Jun 2017, 9:16 AM
Nomeh Uchenna Gabriel
Nomeh Uchenna Gabriel - avatar
+ 4
I had a similar question in Maths!
30th Jun 2017, 8:55 AM
👑 Prometheus 🇸🇬
👑 Prometheus 🇸🇬 - avatar
+ 2
Thanks @Amrit, waiting for your next brain teasing question.
30th Jun 2017, 8:53 AM
Nomeh Uchenna Gabriel
Nomeh Uchenna Gabriel - avatar
+ 2
post a link @S Vengat
30th Jun 2017, 8:58 AM
Nomeh Uchenna Gabriel
Nomeh Uchenna Gabriel - avatar
+ 1
lol = t => t < 20 ? 1 : Math.ceil((t-20)/16)*1.5 + 1 lol(42) // 4
29th Jun 2017, 10:15 AM
David Sebastian Keshvi Illiakis
David Sebastian Keshvi Illiakis - avatar
+ 1
Just released the next one.. xD
30th Jun 2017, 8:59 AM
Dragon Slayer Xavier
Dragon Slayer Xavier - avatar
29th Jun 2017, 12:08 PM
Flandre Scarlet
Flandre Scarlet - avatar