I use recursion in Java. When n is less than 2 just return the n
When n gets larger, it becomes a fabonacci number
but every time I submit it says time limit exceeded
It is better to solve this problem using DP, If you do want to use recursion, you may can use a buffer to record the stairs you have counted to avoid do the same recursive call again.
If you did not get what I am saying, just google "fibonacci series dynamic programming ".