Question: using python 11. [Programming) Longest Good Segment You're given a set of non-zero, positive integers on a single line Standard Input, each separated by a

using python
using python 11. [Programming) Longest Good Segment You're given a set of

11. [Programming) Longest Good Segment You're given a set of non-zero, positive integers on a single line Standard Input, each separated by a space. The first number is M, the lower bound of an interval (inclusive) The second number is N, the upper bound of an interval (inclusive) The remaining numbers are called bad numbers A Good Segment is the longest continuous range of natural numbers between M and N (inclusive), which does not include any bad numbers. Your task: Given an interval and a set of bad numbers, calculate the length of the longest Good Segment and print it to Standard Output. Example Input 1 10 5 4 2 15 Output 5 Explanation The interval is [1,10), inclusive. The bad numbers are (5, 4, 2, 15). All possible segments having no bad numbers: [1, 12, 13, 3), and [6, 10). The longest length segment is (6, 10) having length 5

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!