Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

POTD_27_09_2024.cpp #205

Open
Avnee29 opened this issue Oct 24, 2024 · 1 comment
Open

POTD_27_09_2024.cpp #205

Avnee29 opened this issue Oct 24, 2024 · 1 comment

Comments

@Avnee29
Copy link
Contributor

Avnee29 commented Oct 24, 2024

📝 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.

Copy link

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant