← All problemsSign in

rnumber

In this problem your task is to reduce a given number 'N' to a non-positive number in as little moves as possible. The moves allowed are : Given an integer 'N' you can subtract one of its factors (excluding 'N' itself) from 'N' and continue the same process with the resulting number until you reach a non-positive number. Note that there is a special case when N=1, you can subtract '1' to reach 0.

HINT LADDERno hints yet
L1 Observation
L2 Technique
L3 Approach
L4 Pseudo-code
🔒
L5 Full solution
L5 unlocks only if you insist twice
solution.cppC++17

CodeSearch Tutor

Hints, not spoilers — it won’t hand over the full solution unless you insist.

voice by Sarvam AI

Sign in to chat with the tutor and save your progress.

Sign in to start