The manager of a tower construction company wants to analyze the tower structure. He has a list of floor numbers where the reflection of the floor was visible from a bird's-eye view. Help the manager to reconstruct the maximum height of the tower and its possible configurations from these reflections. The output should be a string in the format 'The maximum height of the tower is X because the first floor number is Y and the last floor number is Z.'
Explanation: Step-by-step: with input [1, 2, 3, 4, 5], we can determine that the maximum height of the tower is 5 because the first floor number is 1 and the last floor number is 5. The possible configurations are the numbers from 1 to 5.
Explanation: Step-by-step: with input [1, 3, 5, 7], we can determine that the maximum height of the tower is 7 because the first floor number is 1 and the last floor number is 7. The possible configurations are the numbers from 1 to 7, but only the odd numbers are present in the input.
Master coding challenges related to Arrays and solve the [Backup] Reconstruct Tower from Reflections problem optimally.
No dry run loaded.
🚀 Practice this problem
Run code, get AI hints & track streak