InterviewDB Question

Longest Contiguous Houses Matching Criteria - Sliding Window Coding Interview

Question Details

Problem You are given a street as an array where each element represents a house's property value. Find the length of the longest contiguous subarray of houses where: The difference between the maximum and minimum value in the subarray is at most k. The subarray contains at least one house with value >= threshold. Example: Follow-ups How do you maintain running max and min efficiently as the window slides? (monotonic deques) What is the time complexity of your sliding window approach? Remove con…

Full Details

🔒

Unlock all Codesignal questions

Full insider details, leaked discussions, and candidate experiences.

or every company, $100/year →

About This Question

This is a reported interview question from a codesignal interview.

It covers the following topics: Q4, Sliding Window, General Coding Assessment, Coding, Arrays .