0

Anyone can solve it by JavaScript code

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.

1st Feb 2022, 12:36 PM
Amazing Hub
5 Answers
+ 3
1st Feb 2022, 1:08 PM
SoloProg
SoloProg - avatar
1st Feb 2022, 2:31 PM
JaScript
JaScript - avatar
+ 1
Anyone can solve it by JavaScript code. What is your question? Where is your try?
1st Feb 2022, 1:01 PM
Jayakrishna šŸ‡®šŸ‡³
0
But input is 42 but expected output is 8plz solve it
1st Feb 2022, 2:10 PM
Amazing Hub
0
U have done input 32and output is 6
1st Feb 2022, 2:11 PM
Amazing Hub