Longest Run of Houses
Asked at Meta
Reported by the problem's creator, not verified
Houses are built one at a time along a street. Two houses are contiguous when their positions are consecutive integers, and a run is a maximal group of contiguous houses.
Examples
Example 1
Input: queries =
[2,10,3,4]Output:
[1,1,2,3]Explanation: After house 2 the longest run is 1, and house 10 does not touch it. House 3 joins 2 into a run of 2, and house 4 extends it to 3.
Import your own questions
Paste a question you were asked and get a full problem: statement, tests and a checked solution.