Skip to content

Day 321 #651

Closed
Closed

Description

@vaskoz

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.

Activity

  1. self-assigned this
    on Jul 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions