Practice Heaters
Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.
Problem Statement
Winter is coming! During the contest, your first job is to design a standard heater with a fixed warm radius to warm all the houses. Every house can be warmed, as long as the house is within the heater's warm radius range. Given the positions of houses and heaters on a horizontal line, return the minimum radius standard of heaters so that those heaters could cover all houses. Notice that all the heaters follow your radius standard, and the warm radius will the same.
Source: Heaters on LeetCode. Use the original task for its coding environment and submissions.
Examples
# Example 1
houses = [1,2,3], heaters = [2]
1
# Example 2
houses = [1,2,3,4], heaters = [1,4]
1
# Example 3
houses = [1,5], heaters = [2]
3
Constraints
Related LeetCode Problems
Practice more problems similar to Heaters.
Review your practice with PhantomCodeAI
After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.