← All problemsSign in

Subset Numbering

CodeChefRating 2640Open on judge ↗

Given a subset of digits S and a number N, find the smallest positive number which contains only the digits from S and is a multiple of N or -1 if solution does not exists. ###Input: - First line contains integer $t$, denoting the number of test cases - First line of each test case contains two integers, $m, N$, denoting size of set S and the number whose multiple you have to find. - Next

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