Find smallest number with given number of digits and sum of digits | Greedy | DSA Sheet | Amazon 🔥

Поделиться
HTML-код
  • Опубликовано: 12 сен 2024
  • #greedy #competitiveprogramming #coding #dsa
    Hey, Guys in this video I have explained with code how we can solve the problem 'Find the smallest number with a given number of digits and sum of digits'.
    CODE-- ideone.com/38envp
    Join our Telegram Channel for more Information
    🔰 Telegram Channel Link = t.me/CodeLibrary1
    🔰 Telegram Discussion Group Link = t.me/CodeLibra...
    🔰 Get 10% OFF on all GeeksforGeeks Courses
    Coupon Code = CODELIBRARY
    🔰 Array Playlist = • Love Babbar DSA 450 Qu...
    🔰 String Playlist = • Love Babbar DSA 450 Qu...
    🔰 Searching and Sorting Playlist = • Love Babbar DSA 450 Qu...
    🔰 Binary Tree Playlist = • Love Babbar DSA 450 Qu...
    🔰 Linked List Playlist = • Love Babbar DSA 450 Qu...
    🔰 Graph Playlist = • Love Babbar DSA 450 Qu...
    🔰 Dynamic Programming Playlist = • Love Babbar DSA 450 Qu...
    🔰 Informative Videos = • Informative Videos
    🔰 Love Babbar DSA Sheet: drive.google.c...
    Follow us on Instagram:
    🔰 Shailesh Yogendra : / shaileshyogendra
    🔰 Yogesh Yogendra : / i_am_yogesh_here
    Follow us on LinkedIn:
    🔰 Yogesh Yogendra : / yogesh-yogendra-26bbb518a
    🔰 Shailesh Yogendra : / shailesh-yogendra-8b13...
    Hope you like it. Comment if you have any doubt
    LIKE | SHARE | SUBSCRIBE

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

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

    Thanks

  • @ravulaakhilsurya8569
    @ravulaakhilsurya8569 3 года назад +6

    Ideas that you can do to help us.
    1,Do code reviews of subscribers bro
    2.which algorithm is used in which situations

  • @siddhantyadav4531
    @siddhantyadav4531 3 года назад +3

    Bhai you re doing one of greatest work because none of the you tuber is solving love babbar sir sheet please carry on this work one of the best RUclips channel 👍👍👍👍👍👍👍

  • @shantanukumar4081
    @shantanukumar4081 2 года назад +1

    Great explanation brother 🤞🤞🤞

  • @lakshyaKumar12
    @lakshyaKumar12 Год назад +3

    this is what happens when u try to rote learn the code and explain it to someone lol so many errors in dictating the logic

  • @omkar.gaikwad
    @omkar.gaikwad 3 года назад

    Thanks, well explained :)

  • @krishnodas6678
    @krishnodas6678 2 года назад

    naaaaaaice bro love u

  • @shivamtiwari3672
    @shivamtiwari3672 2 года назад

    If u want small code
    string smallestNumber(int sum, int n){
    if(n*9=0;i--){
    if(sum>9){
    str="9"+str;
    sum-=9;
    }
    else{
    if(i==0) str=to_string(sum)+str;
    else{
    str=to_string(sum-1)+str;
    sum=1;
    }
    }
    }
    return str;
    }

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

    🔥

  • @amit2194
    @amit2194 Год назад

    if(S>9*D) return "-1";
    string ans="";
    while(S>0 && D>0){
    if(S>9 ){
    ans='9'+ans;
    S-=9;
    D--;
    }
    else{
    ans=to_string(S-1)+ans;
    D--;
    S=1;
    while(D>1){
    ans='0'+ans;
    D--;
    }
    ans='1'+ans;
    }
    }
    return ans;
    can you find error int his code??

  • @gautamgoel2024
    @gautamgoel2024 2 года назад +1

    Thus was not intuitive . But learnt something new.

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

    Thanks a lot bro