Back to Browse

Maximum Ones after Modification InterviewBit Code + Examples C++

12.0K views
Sep 28, 2021
17:52

Given a binary array A and a number B, we need to find length of the longest subsegment of ‘1’s possible by changing at most B ‘0’s. A[i]=0 or A[i]=1 Input Format First argument is an binary array A. Second argument is an integer B. Output Format Return a single integer denoting the length of the longest subsegment of ‘1’s possible by changing at most B ‘0’s. Example Input Input 1: A = [1, 0, 0, 1, 1, 0, 1] B = 1 Input 2: A = [1, 0, 0, 1, 0, 1, 0, 1, 0, 1] B = 2

Download

1 formats

Video Formats

360pmp435.2 MB

Right-click 'Download' and select 'Save Link As' if the file opens in a new tab.

Maximum Ones after Modification InterviewBit Code + Examples C++ | NatokHD