Count ways to N'th Stair | GfG Problem of the Day | Dynamic Programming

Поделиться
HTML-код
  • Опубликовано: 7 окт 2024

Комментарии • 4

  • @codetips-byRochak
    @codetips-byRochak  Месяц назад

    Let's Connect 🤝 :
    LinkedIn : www.linkedin.com/in/rochak-vyas17/
    Code :
    class Solution{
    public:
    int nthStair(int n){
    int dp[n+1];
    dp[1]=1;
    dp[2]=2;
    for(int i=3;i

  • @jayrathod9271
    @jayrathod9271 Месяц назад +1

    return int(n/2) +1

    • @codetips-byRochak
      @codetips-byRochak  Месяц назад

      Yeah this can also work

    • @vijayanks1714
      @vijayanks1714 Месяц назад

      your solution ok but for longer run learn the dp variation that is the take from the problem