Problem name-Roof Top
You are given the heights of consecutive buildings. You can move from the roof of a building to the roof of the next adjacent building. You need to find the maximum number of consecutive steps you can put forward such that you gain an increase in altitude with each step.
The problem involves analyzing a sequence of building heights to determine the longest stretch where you can move from one building to the next, gaining height with each move.
The problem of finding the maximum number of consecutive steps you can take while gaining altitude between adjacent buildings has practical applications in various fields, including architecture, urban planning, and even gaming.
Initialize Counters: Start with max_steps and current_steps set to 0.
Iterate Through Heights: Loop through the array of building heights:
For each building, check if the next building is taller.
If it is, increment current_steps.
If it isn't, reset current_steps to 0.
Update Maximum: After each comparison, update max_steps if current_steps exceeds it.
Return Result: After the loop, return max_steps, which represents the longest stretch of increasing height.
Welcome, @Avnee29! Thanks for raising the issue.
Soon the maintainers/owner will review it and provide you with feedback/suggestions.
Make sure to star this awesome repository and follow the account!
π Description
Problem name-Roof Top You are given the heights of consecutive buildings. You can move from the roof of a building to the roof of the next adjacent building. You need to find the maximum number of consecutive steps you can put forward such that you gain an increase in altitude with each step. The problem involves analyzing a sequence of building heights to determine the longest stretch where you can move from one building to the next, gaining height with each move.
π‘ Enhancement / Feature Request (if applicable)
The problem of finding the maximum number of consecutive steps you can take while gaining altitude between adjacent buildings has practical applications in various fields, including architecture, urban planning, and even gaming. Initialize Counters: Start with max_steps and current_steps set to 0. Iterate Through Heights: Loop through the array of building heights: For each building, check if the next building is taller. If it is, increment current_steps. If it isn't, reset current_steps to 0. Update Maximum: After each comparison, update max_steps if current_steps exceeds it. Return Result: After the loop, return max_steps, which represents the longest stretch of increasing height.