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

Day 321 #651

Closed
vaskoz opened this issue Jul 9, 2019 · 0 comments · Fixed by #652
Closed

Day 321 #651

vaskoz opened this issue Jul 9, 2019 · 0 comments · Fixed by #652
Assignees

Comments

@vaskoz
Copy link
Owner

vaskoz commented Jul 9, 2019

Good morning! Here's your coding interview problem for today.

This problem was asked by PagerDuty.

Given a positive integer N, find the smallest number of steps it will take to reach 1.

There are two kinds of permitted steps:

  • You may decrement N to N - 1.
  • If a * b = N, you may decrement N to the larger of a and b.
    For example, given 100, you can reach 1 in five steps with the following route: 100 -> 10 -> 9 -> 3 -> 2 -> 1.
@vaskoz vaskoz self-assigned this Jul 9, 2019
@vaskoz vaskoz mentioned this issue Jul 10, 2019
@vaskoz vaskoz mentioned this issue Jan 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant