Pregunta de entrevista de Amazon

Coding question which I solved in Python to do with sliding window calculating the maximum contiguous sub-array containing some special characteristic.