Challenge: Primitive Calculator

Solve the Primitive Calculator Problem.

We'll cover the following

Problem


Primitive Calculator Problem

Find the minimum number of operations needed to get a positive integer nn from 11 using only three operations: add 11, multiply by 22, and multiply by 33.

Input: An integer nn.

Output: The minimum number of operations “+1+1,” “×2×2,” and “×3×3” needed to get nn from 1.

Level up your interview prep. Join Educative to access 70+ hands-on prep courses.