Solve Manually for some cases you will find this is none other than a fibonacci series
I asked such a Q in my time too, that how to tackle these type of problems.
The reply was that, generally these type of problems have some underlying trick/principle which we have to decipher. Because going brute force over these problems isn’t generally advised.
Also, should you required to calculate nCr or nPr values of big numbers, then theres a trick for that too. Usually such Q give “print result % 10^7+7” or etc. Recall than (a x b)%n = [(a%n) x (b%n)]%n. Use the formula for calculating nCr or nPr by nCr-1 or such (Cant exactly recount) and store it modulo n. (Since in the end it wont matter whether you modulo it before multiplication or after multiplication. Eg- (5x4)%3=20%3=2, and (5%3 x 4%3)%3 = (2x1)%3= 2… It doesn’t matter if I store 5 in the variable or 5%3. Similar holds here. So we can store those large nCr or nPr values should their use be required in formula.)
BTW- Lol, thanks naksh, even I was stuck on that Q.
this link would serve the purpose… there is a lot to learn here