Pls help me solve

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.

3rd Oct 2022, 2:16 PM
Ebube Uwadia
Ebube Uwadia - avatar
4 Answers
+ 4
Please don't just drop task descriptions here. "help me solve" does NOT mean that others write code for you. Please link your code attempt so we can check on it and suggest you how to go on. https://www.sololearn.com/discuss/3089867/?ref=app https://www.sololearn.com/discuss/3089866/?ref=app
3rd Oct 2022, 2:23 PM
Lisa - avatar
Ebube Uwadia Please try to attempt it! Q/A section is ment for asking doubt but this doesn't mean we'll do your homework, at least try to attempt the question.
3rd Oct 2022, 2:53 PM
Snehil Pandey
Snehil Pandey - avatar
I am trying really hard myself
3rd Oct 2022, 3:31 PM
Ebube Uwadia
Ebube Uwadia - avatar
Hint - One for loop ,if condition and counter can do the job for you
4th Oct 2022, 9:34 PM
Abhishek Rajput
Abhishek Rajput - avatar