1. Engineering
  2. Computer Science
  3. tintin is growing plants along a line he notes their...

Question: tintin is growing plants along a line he notes their...

Question details

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.

Solution by an expert tutor
Blurred Solution
This question has been solved
Subscribe to see this solution