Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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 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 OutputStep 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