Company: Texas

Difficulty: medium

Problem Statement

Longest Passage After Traffic-Light Insertions A street has endpoints `0` and `X`. Insert traffic lights at the given distinct positions one at a time. After each insertion, print the maximum distance between adjacent lights or endpoints. Input Format The first line contains `X` and `N`. The second line contains `N` distinct positions. Output Format Print `N` space-separated answers. Constraints `2 <= X <= 10^9`, `1 <= N <= 2*10^5`, and every position is strictly between `0` and `X`.

More Texas OA questionsInterview experiences