Order does not matter problem

https://practice.geeksforgeeks.org/problems/count-ways-to-nth-stairorder-does-not-matter/0

i have used the logic of coin change problem (0-n knapsack) as it is similar in this problem but it shows tle…

and plz optimize my approach as well…

also tell since n<=10^6
how to create a 2d array of [1000005][3]?? as it will show seg fault …

Why is no one replying it’s already been days

Reply at the earliest…plz