Neha and Destination
CodeChefOpen on judge ↗
$Neha$ want to reach a destination but she decide that she can make moves in two directions only. If $Neha$ is at position $(x,y)$ , then she can move to $(x+1,y+1)$ or $(x+1,y)$. $Neha$ must start her journey from $(0,0)$ and her destination is $(X,Y)$ . Your task is to find the minimum number of moves that $Neha$ require to reach the destination or if she cannot reach the destination. ###Inp
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.
Sign in to chat with the tutor and save your progress.
Sign in to start