← All problemsSign in

Come Back Home!!

There are $K$ villages numbered from $1$ to $K$ in the countryside. You live in a village numbered $1$. All villages are interconnected. The cost of traveling from one village to another is $1$ coin. You have exactly $N$ coins with you. Your task is to find in how many ways you can spend exactly $N$ coins so that you start from your home village $1$ and return to your home village in the end.

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