Panda Guru LogoPanda
Guru

Salesforce OA

Round 1

Questions: You are given a binary string s containing only 0s and 1s. Your task is to minimize the length of the longest consecutive substring of the same character by performing at most k operations. In one operation, you can flip a single bit: change a 0 to 1 or a 1 to 0.

Input:

Output:

Sample test case: Input:

s = "00000" k = 2

Output: 1

Follow-up Question

I solved it but didn't pass all test cases. I kinda knew my greedy approach using max heap would not work. How to approach this?

Candidate's Approach

No approach provided.

Interviewer's Feedback

No feedback provided.