Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Tintin is growing plants along a line. He notes their heights in an array. He wants to find out if there is a group of
Tintin is growing plants along a line. He notes their heights in an array. He wants to find out if there is a group of 4 plants such that their heights are in increasing order and differ only by 1 each?
Given an array with the heights, you have to print True or False.
Example: for [1,2,3,4,0], you should print True because there is a group 1,2,3,4 that matches our criteria. Example: for [1,2,3,0,4,5,0,6,7,0,8,9], you should print False because the required group is not present.
Write programming logic for the above.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started