Check if list is inclusive We will define a list of integers to be inclusive if it meets the following conditions:
It should have at least 6 elements The list should contain the mid-point of the first and the last elements of the list Complete the given method solve which takes as parameter a list A. Return True if the list is inclusive and False if it is not inclusive.
Example Input: 10 3 4 5 Output: False Explanation: List is less than 6 elements
Example Input: 3 9 8 4 5 7 Output: True Explanation: mid-point of 3 and 7 is 5, which exists in the list
Example Input: 5 9 8 12 2 4 7 5 Output: False Explanation: mid-point of 5 and 5 is 5, which doesn't exist in rest of the list
https://stackoverflow.com/questions/66828498/the-list-have-to-pass-the-conditionsit-must-have-at-least-6-elements-list-shoul March 27, 2021 at 02:07PM
没有评论:
发表评论