Dearrangement Error
CodeChefOpen on judge ↗
As we all know the formula of dearrangement in the form of the recursive equation but Chef forgot the main equation and wrote down the following: \[ A(n)= \begin{cases} 2A(n-1) +3 A(n-2),& \text{if } n\geq 2\\ 2,& \text{if } n = 1 \\ 1, & \text{if } n = 0 \\ \end{cases} \] One of his friend pointed out that there is some error in the formula written by Chef so he added something in Chef's equat
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