← OYO questions

Minimum steps to reach destination floor using up and down elevator buttons

Filed under OYO

In an N-floor building, you start at floor S and want to reach floor D. You can only move up by U floors or down by d floors. Find the minimum number of moves to reach floor D. If it is impossible…

You've read your 3 free write-ups

Sign up free to keep reading. Your account opens the first 10 questions of every company.

Related OYO questions

Collected from public candidate posts and coding forums. Updated Nov 2026.