0 day streak
Anonymous · shared experience20 May 2026 · 6 views

Tekion: Longest run of ones if you can flip up to k zeros

Interview question #Tekion SDE 2 DSA / coding

Problem. Given a binary array and a number k, find the longest stretch of consecutive 1s you can get if you are allowed to flip at most k 0s to 1s.

What happened. It was the second problem in the round, after the candidate struggled with a meeting rescheduling problem. They tried to reuse the idea from the first problem and missed the simpler approach, which led to a rejection.

Approach. A sliding window that grows to the right and shrinks from the left whenever it holds more than k zeros. The best window length seen is the answer, in O(n) time and O(1) space.

Lesson from the candidate. Read each problem fresh and confirm it with an example before coding.

0 comments

Comments 0

No comments yet. Ask the author something, or add what happened in your own round.