Company: Visa_6nov
Difficulty: medium
Longest Segment of Contiguous Houses Problem Description You are monitoring the building density in a district of houses. The district is represented as a number line, where a house can be built at each numbered point on the line if at least one of the neighboring points is not occupied. Initially, there are no houses in the district. You are given an array of integers queries representing the locations of new houses in the order in which they will be built. After each house is built, your task is to find the longest segment of contiguous houses in the district. Return an array of integers representing the longest segment of contiguous houses after each respective house from queries is built. Note: It's guaranteed that all of the house locations in queries are unique and no house was built at a point with existing houses on both left and right adjacent points. Assume that array indices are 0-based. Examples Example 1: Input: queries = [2, 1, 3] Output: [1, 2, 3] Explanation: Let's look