insidcode
ProblemsDuelLeaderboardStats
Sign In
  1. Home
  2. Problems
  3. Print pattern of increasing characters (A, AB, ABC...).

Print pattern of increasing characters (A, AB, ABC...).

Difficulty: Medium

Phase: 6 · Mixed Logical Challenges

XP Reward: 20 XP

Topics: Mixed Logical Challenges, Medium

Supported Languages: Python, JavaScript, C, C++, Java

Problem Description

Given binary array of N elements (0s and 1s), find maximum consecutive 1s after flipping at most one 0. Input Format: Read input from standard input (stdin). Output Format: Print the result to standard output (stdout).

Constraints

  • -10^9 <= N <= 10^9

Examples

Example 1

Input: 5 1 0 1 1 0

Output: 4

Explanation: Sample execution for input 5 1 0 1 1 0