#include <bits/stdc++.h> int countDistinctWays(long long nStairs) { // Write your code here. //Base case if(nStairs<0) return 0; if(nStairs==0) return 1; int ans=countDistinctWays(nStairs-1) + countDistinctWays(nStairs-2); return ans; }
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter