← All problemsSign in

Tom and Series

Tom likes to find the new math series.Sometimes he modies famous known series .Today he modified the Fibbonacci series and generates a new series named Tom series. T1 = 0 T2 = 1 T3 = 1*2 + 0*1 = 2 Tn = Tn-1 * (n-1) + Tn-2 * (n-2) Now Tom wants to count the frequency of given integer K at Nth position in series. Input - First line of input contains a integer T denotes the number of test cases.

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