You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
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 reach1
.There are two kinds of permitted steps:
N
toN - 1
.a * b = N
, you may decrementN
to the larger ofa
andb
.For example, given
100
, you can reach1
in five steps with the following route:100 -> 10 -> 9 -> 3 -> 2 -> 1
.The text was updated successfully, but these errors were encountered: