- 3

Can anyone answer it?

The snail climbs up 7 feet each day and slips back 2 feet each night. How many days will it take the snail to get out of a well with the given depth? Sample Input: 31 Sample Output: 6 Explanation: Let's break down the distance the snail covers each day: Day 1: 7-2=5 Day 2: 5+7-2=10 Day 3: 10+7-2=15 Day 4: 15+7-2=20 Day 5: 20+7-2=25 Day 6: 25+7=32 So, on Day 6 the snail will reach 32 feet and get out of the well at day, without slipping back that night.

26th Jan 2021, 11:30 PM
❤️😍Prerana😍❤️
❤️😍Prerana😍❤️ - avatar
5 odpowiedzi
+ 4
Pick your language of choice and try to implement what you wrote. If you get stuck, ask about your difficulty.
27th Jan 2021, 1:06 AM
Sonic
Sonic - avatar
+ 3
Sathe Prerana Satish you're welcome 👍
27th Jan 2021, 11:14 AM
Sonic
Sonic - avatar
+ 2
Ok thanks to all🙏
27th Jan 2021, 7:22 AM
❤️😍Prerana😍❤️
❤️😍Prerana😍❤️ - avatar
+ 2
Thank u sonic🙏🙏
27th Jan 2021, 10:31 AM
❤️😍Prerana😍❤️
❤️😍Prerana😍❤️ - avatar