← All problemsSign in

Digit Space

CodeChefRating 2554Open on judge ↗

For an integer $x$, define its *digit space* $D_x$ to be the set of all positive integers whose decimal representation is a rearrangement of the decimal representation of $x$, when written without leading zeros. For example, if $x = 2024$, then $D_x = \{4022, 4202, 4220, 2042, 2024, 2402, 2420, 2204, 2240\}$. For two integers $x$ and $y$, define $f(x, y)$ to be the maximum **prime** number that

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