Nth Natural Number - GeeksforGeeks - Day 2 of 30DaysofCode -

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

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

  • @madhav3444
    @madhav3444 3 года назад +1

    the first bruteforce solution will always give TLE because start is only incrementing when digit does not contain "9" . So the while loop will never terminate isn't it ?

  • @akhildhingra8393
    @akhildhingra8393 3 года назад +1

    I really couldn't understand the log part. Can you help me explaining it a little bit detail?😕😕 I didn't understood base 9 base 10, the relation of this to problem. Thank you

  • @kunalsaha9239
    @kunalsaha9239 3 года назад

    Your linked in profile in not available!!!!!!!

    • @SaiprakashReddy
      @SaiprakashReddy  3 года назад +1

      Hello Kunal,
      Lol.. thanks for mentioning that , copy paste messed it up ... I have updated the links and thanks for the sub 🤝

    • @abbaammi5836
      @abbaammi5836 3 года назад

      Bro iam watching these videos after 6 months how can I get ur 30 days videos

  • @nupurgarg2892
    @nupurgarg2892 3 года назад

    can you help with this code in C++

    • @kalyanchowdhury2240
      @kalyanchowdhury2240 3 года назад

      vector v;
      while(N)
      {
      v.push_back(N%9);
      N /= 9;
      }
      long long ans = 0;
      for(int i=v.size()-1;i>=0;i--)
      ans = ans*10+v[i];
      return ans;

    • @SaiprakashReddy
      @SaiprakashReddy  3 года назад

      Hello kalyan ,
      This code works but you are using additional vector memory . You can do this in 0(1) space .

    • @nupurgarg2892
      @nupurgarg2892 3 года назад +1

      @@kalyanchowdhury2240 thank you

    • @prabhattiwari5964
      @prabhattiwari5964 3 года назад

      @@kalyanchowdhury2240
      while(N)
      {
      v.push_back(N%9);
      N /= 9;
      }
      what this will do

    • @kalyanchowdhury2240
      @kalyanchowdhury2240 3 года назад

      @@prabhattiwari5964 Do dry run with any example..

  • @ShivaniSingh-jt6kl
    @ShivaniSingh-jt6kl 3 года назад

    Where is today's code?

    • @SaiprakashReddy
      @SaiprakashReddy  3 года назад

      Hey , these are being published on geeks for geeks youtube channel .

  • @kunalsaha9239
    @kunalsaha9239 3 года назад +1

    And pls continue till day_30 :):)

  • @devendrapandey4059
    @devendrapandey4059 3 года назад +1

    What is Day1 problem?

    • @SaiprakashReddy
      @SaiprakashReddy  3 года назад

      Hello Devendra ,
      I couldn't exactly recall the name but it was an easy problem related to array index manipulation .

    • @nupurgarg2892
      @nupurgarg2892 3 года назад

      Geek and his classmates

    • @SaiprakashReddy
      @SaiprakashReddy  3 года назад

      @@nupurgarg2892 thanks Nupur