PAYPAL INDIA Hiring | Max Consecutive Ones III Problem | On Campus Online Assessment (2022|
PayPal · Question · Posted Jun 2026
Problem Statement You are given a binary array nums consisting of only 0s and 1s, and an integer k. You can flip at most k zeros into ones. Your task is to find the maximum number of consecutive 1s that can be obtained after performing at most k flips. Return the length of the longest contiguous subarray containing only 1s after the allowed flips. Example 1 Input nums = [1,1,1,0,0,0,1,1,1,1,0] k = 2 Output 6 Explanation Flip two zeros in ...
The full answer & interview discussion are available to premium members.
Log in Create a free account