We’re preparing your current view and syncing the latest data.
Given an array of towers represented by their heights and connections between these towers, find the tower that is reachable starting from the first tower (index 0) by only moving to towers with heights less than or equal to the current tower, such that the tower has the maximum height possible. Return the height of the best reachable tower.
An array heights of integers where heights[i] represents the height of the ith tower and a list of edges representing connections between towers.
An integer representing the maximum height of a reachable tower starting from tower 0 moving only to towers of height less than or equal to the current tower.
1 <= number of towers <= 10^5 1 <= height of each tower <= 10^6 The edges form a graph connecting the towers.