Count and Say | Strings | Hindi | LeetCode | Problem Solving | FAANG | Shashwat

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

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

  • @shashwat_tiwari_st
    @shashwat_tiwari_st  Год назад +2

    This is a very old video, for better sound and camera quality DSA videos, learn from the below playlist!
    Java Plus DSA ( Java + DSA + Problem Solving )
    ruclips.net/p/PLQ7ZAf76c0ZPVdhV1bAjFv0bQc1xHURzE

  • @kunalkheeva
    @kunalkheeva Год назад +4

    learned three things from it, one the if statement condition thing, second StringBuilder thing third obviously the code, thank you.

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

    Great explanation!!! keep doing more videos like these your channel will see an exponential growth

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

    Very underrated channel yet the best channel I found on youtube to understand the approach of problem statement

  • @zaffariqbal3671
    @zaffariqbal3671 2 года назад +2

    You are very supportive and helpful..Thanks a lot for your valuable contents...

  • @avinashgangaji4709
    @avinashgangaji4709 11 месяцев назад +1

    yes please make a dedicated video on String and StringBuilder concatenation . btw great explaination

    • @shashwat_tiwari_st
      @shashwat_tiwari_st  11 месяцев назад

      All the videos are out.
      Check below playlist, First 3 lectures have answers to your queries,
      ruclips.net/p/PLQ7ZAf76c0ZNSyf7ZiW5MO4onN2FId5Xw&si=x9JLO4UNPc6xjZqM

  • @shivambhardwaj3273
    @shivambhardwaj3273 2 года назад +3

    good job bro, your explanation went right through the head.
    Please do organise your DSA question playlist topic wise so that if someone has to do a string, they can find all string's questions at one place.

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

    Mast bro.. maja aa gya... aapki video suggestions me aati thi to me nhi dekhata tha lekin aaj dekha achhe se samjha kadak🤠🤠

  • @yashmankar5637
    @yashmankar5637 2 года назад +3

    Superbbb 🔥🔥🔥🔥
    You had solved & explained this tough question very easily 🥳🥳🥳

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

    Thank you for explain the question. Very hard to understand the question before your video. You explain the logic in a very easy way. Thanks again.

  • @Manu.822
    @Manu.822 Год назад

    Beautiful solution. You explained this so clearly and the approach is soo different it's amazing.

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

    Thank you for explaining this problem so easily.

  • @ProRhythm-o4w
    @ProRhythm-o4w Год назад

    best explanation of this question across youtube 😍

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

    You explained it very nicely Thanks Sir

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

    A very good explanation. Kindly provide c++ solution too.

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

    Explanation was excellent , thank you so much 😇❤❤

  • @Unwanted-c2v
    @Unwanted-c2v Год назад

    Great Explanation sir.❤❤

  • @dhananjayjadhav7064
    @dhananjayjadhav7064 3 года назад +2

    Thank you so much sir 😊😊❤️❤️

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

    nice explanation bhaiya

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

    explained really well brother

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

    Great Explanation !

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

    Great explanation of the problem statement!
    Thank you

  • @156_yashsawarkar9
    @156_yashsawarkar9 2 года назад

    really good explaination 🙂

  • @AmitChauhan-sp1cw
    @AmitChauhan-sp1cw Год назад

    no need to put i=s.length()-1 because your loop is i

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

    very good explanation ..

  • @Adityasharma-oe8zp
    @Adityasharma-oe8zp 2 года назад

    I love your content ..... Also its very helpfull to me.... Keep it up and thank you

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

    Beautifully explained!!

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

    Nicely explained bro 🙂

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

    Just a small doubt why we use .toString() in the end ?
    Is it always necessary when we are using string builder?

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

      Yes accepted return type of the function is String, that is why we need to convert StringBuilder to String.

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

    awesome.....................

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

    great explanations

  • @kunalhoro8882
    @kunalhoro8882 3 года назад +2

    bhaiya java me string plus integer allowed h kya ?
    i did it in cpp so i had to convert the counter to string by to_string() method while concatenating.

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

      Haan, Java me allowed hai, string and interger "+" sign se concatenate ho jate hai.

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

      @@shashwat_tiwari_st bhaiya ek video large factorial number wala me bana dijiye ho sake toh.
      Q. we have been given an array and need to find large factorial of evry element in it.
      Gfg ka solution dekha tha par utna clear ni hua.

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

      @@kunalhoro8882 👌🆗️

    • @AR-nw6dv
      @AR-nw6dv 2 года назад

      @@shashwat_tiwari_st bhaiyya cpp mai bhi memory and time jyada consume karra hai iske liye kiya kare....

  • @ShubhamKumar-gz5rr
    @ShubhamKumar-gz5rr 2 года назад

    this video really helped.. thank you bhaiya

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

    thanks for explanation

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

    Great work bro

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

    Man gya tiwari bhai

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

    Thanks bro....
    Keep it up...

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

    good approach

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

    Very nice explanation man 🔥

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

    thanks vaya from Bangladesh😀😀😀😀

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

    Thanks bro it.helped a lot 🙏🏻🙏🏻

  • @techkid358
    @techkid358 2 месяца назад

    counter =0;
    loop ke bahar hona after 1 it will get back to 0 in if conditon

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

    Can you tell me the time complexity. for this solution ?

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

    yaar maza aa gya

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

    Nice explanation 🎊🎊🎊

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

    Hello sir.
    Once n=1 it returns from the current function to main function, how countandsay() execute for 2,3 and 4?... Can u please explain this?

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

      Say n is 4.
      F4 calls F3, F3 calls F2, F2 calls F1 and ans of n=1 we know..
      So F1 gets executed,
      After that F2 uses the result of F1 and executes itself.
      F3 uses result of F2 and executes itself.
      Finally F4 uses result of F3 and executes itself. Since F4 was called by main function, so recursion ends here.
      Order is as follows
      CALLING : Main->F4->F3->F2->F1.
      RETURNING : Main

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

      @@shashwat_tiwari_st
      Thank you sir.

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

    Pls, explain the difference between java string and javabuilder.
    why the string is un mutable in java??

    • @shashwat_tiwari_st
      @shashwat_tiwari_st  3 года назад +4

      Java has a concept of String Constant pool which says that no matter how many times we generate a string, it will be created only once in the pool and other will just point towards it or refer to it. This is because same string reference is used across various platforms. Say a String is used in database, at the server side and on the portal. Now if I want to change it on the portal, but I don't want to change it in database and on the server, so, if String is mutable, it will be changed at all 3 places. So, therefore it's made immutable in java.
      What I mean by immutable is:
      Suppose when I create a string x="shashwat"
      It will be created in String pool.
      Now if I create y="shashwat"
      Here in this case, both x and y will refer to same "shashwat" String, and no new string will be created.
      Now suppose, I want to change "shashwat" to "ShashwAT",
      The string pool will now have two string one "shashwat" and the other one as "ShashwAT".
      So, every time I make a change to the String "shashwat", a new string will be generated.
      But, this is not the case with StringBuilder, here we change the same String. So, we have to choose where to use what. There is one more type StringBuffer. Read all three, it's a very interesting concept.
      Anyways, this is why string is slower than StringBuilder.

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

      @@shashwat_tiwari_st got it! Thank you so much, sir.

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

    Wgat is the time complexity?

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

    Thanku 😁😁

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

    itne videos dekhne k baad ek acha video mila... good work bas video baar baar hazy ho jaa rha hai.. uspe thoda sa kaam krlo.. baki explanation perfect hai

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

    thnks :)

  • @NikhilRaj-wv6nf
    @NikhilRaj-wv6nf Год назад

    tq

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

    Bhaiya c++ mai bhi code explain kor na plz it's a request

    • @AR-nw6dv
      @AR-nw6dv 2 года назад +1

      Same he hai ..bas counter ko string mai convert karna hoga ..to_string function use karlo ho jayega ..

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

    Bhai apka video dekhte ho aap shoot karne ke baad , focus hi set nahi hai har 10 sec. mein hil raha hai .

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

    Counter was an integer type , how can be that append to a string variable without any type conversion?😅

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

      It gets implicitly converted to String in java.

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

      @@shashwat_tiwari_st oh okok... I'm a python programmer...so was just curious to know about java

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

    But while we are writting the "res" section, the res one is string+int+string, why isnt it throwing error here.

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

      Java String concatenation.
      String + int + String , plus sign implicitly converts int to String.

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

      @@shashwat_tiwari_st can you tell me about C++.. Coz I'm getting g error bcz of that

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

      @@khushiagarwal2889 use to_string function in cpp to convert counter to String and then concatenate.

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

      res = res + std::to_string(counter) + res;
      Something like this.

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

      @@shashwat_tiwari_st yeah I got the answer thanks😁

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

    work on video clearity please rest is perfect

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

      I will try my best. Please watch java dsa vidoes, for better clarity

  • @kartikshah5985
    @kartikshah5985 4 месяца назад

    nice explanation

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

    good explanation