Question
Hi! im taking a python 3 programming course and am really really bad, my adhd makes my memory very spotty and i have been strugling
Hi! im taking a python 3 programming course and am really really bad, my adhd makes my memory very spotty and i have been strugling for the past few weeks with this class. Im working on a series of python 3 programming questions, the second which being: 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: 1 0110 Output: 2 Input: 3 1111 1010110 11001 Output: 5
Step 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