PAYPAL Hiring Campus OA question | Sliding Window

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 may flip at most k zeros into ones. Return the maximum number of consecutive 1s that can be obtained after performing at most k 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 middle: 1 1 1 0 0 0 1 1 1 1 0       ↑   ↑ ...

The full answer & interview discussion are available to premium members.

Log in Create a free account