Vanya and Lanterns Problem

Vanya and Lanterns Problem — ExecCode Medium DSA Practice

Solve the Vanya and Lanterns problem on ExecCode. Free online medium DSA practice in Binary Search. Write and run code in Java, C++, Python — no signup required to run.

Problem description

A street runs from position 0 to position L. Lanterns stand at the given positions, and each lantern lights the same radius on both sides. Return the minimum radius that lights the entire street. Return the minimum light radius. You are given: L — L lanterns — lanterns Return the minimum light radius. Copied from OA Lab Part 1.

Examples

Input {'L': 10, 'lanterns': [2, 8]}; Output 3. Input {'L': 10, 'lanterns': [0, 10]}; Output 5. Input {'L': 10, 'lanterns': [3, 7]}; Output 3

Constraints

Follow the statement. Use a 64-bit integer when values can overflow.

Practice Vanya and Lanterns free on ExecCode. Browse DSA problems, topic map, and placement guides.