Question: in python 8.27 Programming Assignment 3 Question 3 Sri has a group of vintage string lights with some of the lights being defective. A defective

in python 8.27 Programming Assignment 3 Question 3 Sri has a groupin python

8.27 Programming Assignment 3 Question 3 Sri has a group of vintage string lights with some of the lights being defective. A defective light is shown by 0 and a normal (non-defective) light is shown by 1 in the input. For example, the input "0110" represents a string with 4 lights in which the first and the last light are defective. Sri is interested in finding the longest number of non-defective lights in a row. In the example above, the longest number of non- defective lights is 2, represented by "11". The first line of your input will contain the number of vintage lights followed by a string representation of every light. The output should be a single integer denoting the longest chain of non-defective lights. The chain can continue to the next group of lights, such as in the second example below where the longest number of non-defective lights is 5 with 4 non-defective lights from one string and 1 non-defective light from the second string. Examples: Input: 0110 Output: Input: 1111 1010110 11001 Output

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!