Answered step by step
Verified Expert Solution
Link Copied!

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

image text in transcribedin 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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Design And Relational Theory Normal Forms And All That Jazz

Authors: Chris Date

1st Edition

1449328016, 978-1449328016

More Books

Students also viewed these Databases questions

Question

11. Identify the stage of beyond duality in Gone With the Wind.

Answered: 1 week ago