Skip to content
Onsite

Minimum Pages With 10 or 12 Problems

MediumP3Coding

Shinchan writes exercises in two notebooks. A page of the first notebook holds exactly 10 problems; a page of the second holds exactly 12. He wants to cover exactly n problems with whole pages and waste no space.

Return the smallest number of pages (from either notebook, in any mix) that hold exactly n problems, or -1 if no combination does.

Example 1

Input
n = 22
Output
2
Why
One page of each: 10 + 12 = 22.

Example 2

Input
n = 10
Output
1

Example 3

Input
n = 12
Output
1

Constraints

  • 1 <= n <= 10^5

Hints

Run checks the 3 visible tests, Submit all 12.