Find Nth Term
CodeChefOpen on judge ↗
Find the nth term of a series for which if it is given that if n is less than 2 then the nth term is 1 and if n is greater than or equals to 2 and less than 4 nth term is 2 else nth term will be equal to the difference of (n+2)th term and (n-2)th term. tn = t(n+2) - t(n-2) Where n ≥ 4 The answer could be very large, so compute it modulo with 109 + 7 Input - The first line of the input conta
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