← All problemsSign in

Small Palindrome

CodeChefRating 706Open on judge ↗

Chef has $X$ ones ($1$s) and $Y$ twos ($2$s) in his collection. He wants to arrange all of them into the **smallest possible palindrome number$^{\dagger}$** using **all** of these ones ($1$s) and twos ($2$s). Help Chef with the answer. Note: $X$ and $Y$ are both even numbers. --- $^{\dagger}$A **palindromic number** is a number that remains the same when its digits are reversed. ### Input -

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