Ep5 - Using recursion, check whether a string is a palindrome or not | DSA series

แชร์
ฝัง
  • เผยแพร่เมื่อ 26 ต.ค. 2024

ความคิดเห็น • 194

  • @iamdhirajshastri
    @iamdhirajshastri 2 ปีที่แล้ว +48

    Day 5 Done ✅
    Congratulations Guys, if you are consistent from last 5 days because 5th & 10th day are the most difficult day of consistency ⚡ By the time you'll reach 21st day you will be champ. 👑 Hope this motivates you all❤😊

    • @LearnYardYT
      @LearnYardYT  2 ปีที่แล้ว +10

      Absolutely correct 💯

  • @AbhishekVerma-ev5tv
    @AbhishekVerma-ev5tv 2 ปีที่แล้ว +6

    Points -
    1. Basic solution is to use two pointers from middle, from ends OR reverse the string.
    2. In recursion, we will only take the loop and convert it to recursion. i.e. we still will have left and right end chars in same call (and not have some mechanism to store and compare in appropriate number of call). L and R represent the substring which needs to be checked for substring. [hence the 0 and n-1 initial values as we need to check whole string at first.]
    3. Since, we return boolean as final answer, we will return true/false in base and invalid cases (here base case is a valid case). For Induction step(where we make next call), we don't need to take and/or since this is a Unary recursion tree.
    *Note - Recursive solution is "inferior" to iterative solution in terms of space complexity (expected due to stack)

  • @gouravmehra007
    @gouravmehra007 2 ปีที่แล้ว +4

    I have solving palindrome problems using loop, today i learnt new thing that we can solve it using recursions as well. thanks bro.

  • @productivewind
    @productivewind 2 ปีที่แล้ว +7

    Sorry for the late Fraz bhaiya. But EP 5 is DONE. Thank you for your consistency and I always appreciate you for your 0 to pro
    type content.

  • @naveenh183
    @naveenh183 2 ปีที่แล้ว +7

    One small suggestion Fraz bhai ..!! The logic explanation is superb.! In one go I am able to understand. It would be good if you can explain the code also so that it will be easy for us to understand and this helps us to explain to interviewer also in much smoother way. Because these days interviewers are preferring the explanation of code which we write. I know it might look silly suggestion but it helps us a lot.

  • @bhupendrasingh7788
    @bhupendrasingh7788 2 ปีที่แล้ว +2

    You are hard working for us until finish this series I will never give up
    I will watch your daily lectures and be consistent

  • @krishnakakade3081
    @krishnakakade3081 2 ปีที่แล้ว

    The way of explaination is mindblowing. Keep it up.

  • @dipeshjoshi9126
    @dipeshjoshi9126 2 ปีที่แล้ว

    video best like previous.n/2 is write because there is 0 to 4 and all i assumen .baki no doubts.ur videos is like 6 baj gaya aaaj ka video chalo kar lete hai .im student .but ik working professional ke liye ye daily challange time ki waje se kaffi accha lag raha hoga superb bhaiya.consistent op

  • @anuragkaushik739
    @anuragkaushik739 2 ปีที่แล้ว +1

    Concept cleared !!!amazing

  • @piyushsrivastava5581
    @piyushsrivastava5581 2 ปีที่แล้ว +2

    A small request Fraz to cover more in one video and also plz dry run the code for a few cases. Gives loads of insight like in last video you did ♥️♥️!!! #missionamazon

  • @darshankalathiya8667
    @darshankalathiya8667 2 ปีที่แล้ว

    you are one of the best teacher keep uploading videos brother...

  • @curiouspatel
    @curiouspatel 2 ปีที่แล้ว +1

    Ep5 also done successfully ✅
    Abhi tk sbkuchh mst samajh aa ra 😌

  • @ismitsingh7349
    @ismitsingh7349 2 ปีที่แล้ว +3

    Bhaiya lectures are really good. Like as a beginner I am understanding this recursion series very well but pls suggest how to gain confidence over topic of time and space complexity

  • @amarnathbarpanda5884
    @amarnathbarpanda5884 2 ปีที่แล้ว

    the simplest explanation ever.. loved it.

  • @souvikmukherjee8419
    @souvikmukherjee8419 2 ปีที่แล้ว

    With this course, you are giving us more than DSA lessons
    You are teaching us discipline perseverance and to show up every day no matter what(which will stay for life)
    Thank you so much bhaiya♥

  • @vaishnavirathore5579
    @vaishnavirathore5579 ปีที่แล้ว

    bhai bht acha kaam kra h ....lots of love :)

  • @Shorts-sc3is
    @Shorts-sc3is 2 ปีที่แล้ว +3

    Provide assignments for practice daily. This will help everyone.

  • @mohitroshan3856
    @mohitroshan3856 2 ปีที่แล้ว

    Eagerly waiting for the video daily same as i used to wait for a show on TV in my childhood😄😁

  • @saha7pritam
    @saha7pritam 2 ปีที่แล้ว

    Yeah, now catch your speed.. Feeling confident. 👍

  • @nihalbarudwale
    @nihalbarudwale 2 ปีที่แล้ว +13

    Can you share 1 problem as a homework like after discussing 1 problem in video, you can give us that topic related problem for solving.
    I understood the recursion concept well thanks to you.

  • @hiiiiiiii927
    @hiiiiiiii927 2 ปีที่แล้ว

    Day 5 completed
    Please give more questions for practice and homework

  • @aakashbhargava1
    @aakashbhargava1 2 ปีที่แล้ว +2

    I think we should increase pace of this course its just a suggestion and you know better than me fraz bhaiya
    thank you

  • @sanketbhagat1222
    @sanketbhagat1222 2 ปีที่แล้ว +3

    bhaiya, can you please share the syllabys plan for your course? means expected dates for completion of topics.

  • @zeeshanansari2232
    @zeeshanansari2232 2 ปีที่แล้ว

    Thnq bhaiya for ur every effort

  • @anirudrabrahma_0971
    @anirudrabrahma_0971 2 ปีที่แล้ว +14

    I always do the problem using iterative solution 😂 learnt the recursion approach from this video. Thank you so much for hard work and regularity. Keep on doing that, enjoying so much big bro ❤️❤️

    • @LearnYardYT
      @LearnYardYT  2 ปีที่แล้ว +6

      Woow I see your comment daily ❤️.
      Thanks for writing ☺️

    • @anirudrabrahma_0971
      @anirudrabrahma_0971 2 ปีที่แล้ว +3

      @@LearnYardYT Yeah i love these videos so much because I badly waiting for such bootcamp which covers everything and not wasting time much. I know how you work hard for us. So it is a greatfulness towards you. ❤️

    • @ramakrishna4092
      @ramakrishna4092 2 ปีที่แล้ว +1

      @@LearnYardYT l==r right for base condition why L>=r

    • @ramakrishna4092
      @ramakrishna4092 2 ปีที่แล้ว +1

      @@LearnYardYT can you pls tell me why L>=R in the base condition L== R what is the difference in that

    • @ritikchauhan8902
      @ritikchauhan8902 2 ปีที่แล้ว +2

      @@ramakrishna4092 it helps when size of string is even , do dry run of {1 2 1 1 2 1},you will understand

  • @faisalehsan7407
    @faisalehsan7407 2 ปีที่แล้ว

    Very well explained ! ..Thanks for your support

  • @Abhishek-fo3fc
    @Abhishek-fo3fc 2 ปีที่แล้ว +1

    Done understood day 5✅

  • @sriramulavenkatakrishnakar3724
    @sriramulavenkatakrishnakar3724 2 ปีที่แล้ว

    take a bow for ur consistency

  • @shalimar_mehra
    @shalimar_mehra 2 ปีที่แล้ว

    Present ! I'm owner to you for this lovely video ! Please make more video on recursion ! It Will help me more to strong my DSA Knowledge !🙌✔

  • @abhishekpandey8988
    @abhishekpandey8988 2 ปีที่แล้ว

    Nice explanation bhaiya.
    Thank you for this video

  • @PROTECHRAHUL
    @PROTECHRAHUL 2 ปีที่แล้ว

    Please take more examples or questions on logarithmic time complexity. N also tell please bhaiyaa how to find or think when we can say this is taking log time/space

  • @ratnasanjay
    @ratnasanjay 2 ปีที่แล้ว

    Thankyou bhaiya for this session

  • @papiananda5547
    @papiananda5547 2 ปีที่แล้ว

    Thank you for so good digestible content. One request can you come up with a small scenario of real time project where we are using these DSA concepts. As of filling a form where next questions are based on previous one and have a concept of DSA. Thank you in advance...

  • @surakshitkapoor9373
    @surakshitkapoor9373 2 ปีที่แล้ว

    superb video
    having no doubt😊

  • @praash.
    @praash. 2 ปีที่แล้ว

    Very useful video because since 5 days I solve this question but this solution is best .
    Bhaiya can you make a video for iteratively Approach please.

  • @apptrendz
    @apptrendz 2 ปีที่แล้ว +14

    JAVA CODE
    public class Solution {
    public static void main(String []args){
    Solution ans= new Solution();
    String obj="level";
    ans.isPalindrome(obj);
    }
    public static Boolean Palindrome(int i, int j,String s) {
    if(i>=j) return true;
    if(s.charAt(i)!=s.charAt(j)) return false;
    return Palindrome(i+1,j-1,s);
    }
    public static Boolean isPalindrome(String s) {
    System.out.println(Palindrome(0,s.length()-1,s));
    return Palindrome(0,s.length()-1,s);
    }
    }

    • @amansayer4943
      @amansayer4943 ปีที่แล้ว

      iss it necessary tom take the helper functions

  • @spacelovertelugu44spacelov46
    @spacelovertelugu44spacelov46 ปีที่แล้ว

    So ideally , out depends on inner output is varied in this recurssion

  • @Sandeep-zd6dq
    @Sandeep-zd6dq 2 ปีที่แล้ว

    Bhaiya we want more questions🔥🔥 great explaination

  • @nithins3895
    @nithins3895 2 ปีที่แล้ว

    Thanks for the video
    Day 5
    Consistency✌✌✌

  • @kundanrajpoot212
    @kundanrajpoot212 2 ปีที่แล้ว +1

    Sir, please cover data structures like vectors, maps stacks, queues etc in details.
    Please sir it will be very helpful for people like me who are absolute beginner .

    • @kundanrajpoot212
      @kundanrajpoot212 2 ปีที่แล้ว +1

      Please all these data structures just after this recursion sessions !!

  • @divyanshsagar
    @divyanshsagar 2 ปีที่แล้ว

    Nicely explained!

  • @snehadas2062
    @snehadas2062 2 ปีที่แล้ว

    Waiting for next topics!

  • @aveermukherjee6419
    @aveermukherjee6419 2 ปีที่แล้ว

    nice explanation keep up the good work.

  • @raiyankhan2367
    @raiyankhan2367 2 ปีที่แล้ว

    very good series

  • @rogdex24
    @rogdex24 2 ปีที่แล้ว

    Edit the video to zoom on the code you are writing , it will be more comfortable and good for viewing

  • @mayurpowar2460
    @mayurpowar2460 2 ปีที่แล้ว

    Palindrome problem is now bit easier 🔥🔥

  • @mdsufyankhan1029
    @mdsufyankhan1029 2 ปีที่แล้ว

    Sorry for the late bhaiya 🥲
    But covering all your videos
    Keep making , its very effective ❤️

  • @vinaykamble162
    @vinaykamble162 2 ปีที่แล้ว +1

    Complete Day 5 ❤️

  • @saisravani2625
    @saisravani2625 2 ปีที่แล้ว

    watched till end 👍

  • @sagarpokhriyal6926
    @sagarpokhriyal6926 2 ปีที่แล้ว +1

    Lecture 5 - ☑
    #Dsabyfaraz
    #recursion❤

  • @avadhutlohar5181
    @avadhutlohar5181 2 ปีที่แล้ว +2

    #DAY_5
    Consistency OP🔥🔥🔥🔥

  • @debashissaha7805
    @debashissaha7805 2 ปีที่แล้ว

    Can you also provide practice problems and also what will be the total duration and topics covedered for the entire DSA series?

  • @aakashbhargava1
    @aakashbhargava1 2 ปีที่แล้ว

    waiting for more such content!!!

  • @surakshitkapoor9373
    @surakshitkapoor9373 2 ปีที่แล้ว

    great lecture😊

  • @TravelTracksByDebo
    @TravelTracksByDebo 2 ปีที่แล้ว

    wonderful video

  • @ranitbandyopadhyay
    @ranitbandyopadhyay 2 ปีที่แล้ว

    Video is good with the analysis.

  • @surabhichoubey2987
    @surabhichoubey2987 2 ปีที่แล้ว

    Thank you soo much bhiya for your efforts 🙌 present

    • @LearnYardYT
      @LearnYardYT  2 ปีที่แล้ว +3

      Thanks for writing ❤️

  • @pratiknagpurkar04
    @pratiknagpurkar04 2 ปีที่แล้ว

    started from watching yesterday....today is my day 2 and had completed 5 episodes.......love to watch this serious its motivates me thankyou @leadcodingbyfraz

  • @karandeepsingh5341
    @karandeepsingh5341 2 ปีที่แล้ว

    Sir in this question what is best iteration or recursion can you tell us in every video that with the help of iteration or recursion we can solve it fastly

  • @chandanyadav0306
    @chandanyadav0306 2 ปีที่แล้ว

    Hi Fraz,
    For Palindrome question, java code is not working could you please look on that once and reply me if possible for you.

  • @dashundev1586
    @dashundev1586 2 ปีที่แล้ว

    Very clear

  • @ramankr0022
    @ramankr0022 ปีที่แล้ว

    very helpful

  • @raghu8401
    @raghu8401 2 ปีที่แล้ว

    so great brother

  • @muni939
    @muni939 2 ปีที่แล้ว

    Can you provide detailed schedule for dsa series

  • @prantikofficial
    @prantikofficial 2 ปีที่แล้ว

    Great video !

  • @516_harshjain2
    @516_harshjain2 2 ปีที่แล้ว

    bhaiya can you increase the number of videos uploading to the channel because a video of a question hardly does anything, but though enjoying the course

  • @Sahilsharma-sk5vr
    @Sahilsharma-sk5vr 2 ปีที่แล้ว

    thank you sir

  • @it_08amanagarwal35
    @it_08amanagarwal35 2 ปีที่แล้ว

    Bro it's is good example but I think if we do by two pointer approach then space complexity will be constant as compared to recursive one which O(n) space but good for recursive understanding ❤❤❤❤❤❤

  • @ajayprajapati3029
    @ajayprajapati3029 ปีที่แล้ว

    this is very expensive seriese
    🥰🥰🥰

  • @mma-dost
    @mma-dost 8 หลายเดือนก่อน

    Thanks bhaiya

  • @aveermukherjee6419
    @aveermukherjee6419 2 ปีที่แล้ว

    Sir will the space complexity will also be O(n/2) for the recursive solution?

  • @arupsarkar6871
    @arupsarkar6871 2 ปีที่แล้ว

    It is very good

  • @santhoshireddy1112
    @santhoshireddy1112 ปีที่แล้ว

    Hai sir, I didn't see the code in java, Could you please upload from Episode: 4

  • @adarshsingh4693
    @adarshsingh4693 2 ปีที่แล้ว +1

    day 5 done

  • @terminator2.03
    @terminator2.03 2 ปีที่แล้ว

    Bhaiya , I have doubt for the recursion tree, I mean we are "returning" the function inside the function right so the function will not be there in the stack call to return back to . I think at the end when l = r then we return true and that marks the end of the recursion tree.
    pls clarify my doubt.

  • @chiragkarnwal6740
    @chiragkarnwal6740 2 ปีที่แล้ว

    Very much enjoying 😊

  • @emtiazahmed5333
    @emtiazahmed5333 2 ปีที่แล้ว

    I was check this channel at 6pm but kuch nahi tha🤕 when you upload this lecture☹️

  • @budhadityachatterjee6270
    @budhadityachatterjee6270 2 ปีที่แล้ว

    Ep: 5 Done !

  • @healerbigboss1812
    @healerbigboss1812 2 ปีที่แล้ว

    there is another approach that i used for solving this question hope it can help someone
    bool pallindrom(int index,int size, string &s)
    {
    if(index>=size/2)
    return true;
    if(s[index]!=s[size-index-1])
    return false;
    pallindrom(index+1,size,s);
    }
    bool isPalindrome(string &s)
    {
    return pallindrom(0,s.size(),s);
    }

  • @maazulhaque7293
    @maazulhaque7293 2 ปีที่แล้ว

    Lec 5 Done

  • @ankittjindal
    @ankittjindal 2 ปีที่แล้ว

    oosm explanation

  • @babushaikh6582
    @babushaikh6582 2 ปีที่แล้ว

    I like yours video's 🥰

  • @manikgoel9953
    @manikgoel9953 2 ปีที่แล้ว

    Thanks

  • @oqant0424
    @oqant0424 2 ปีที่แล้ว

    Episode 5 done ✅

  • @DTMASUYASHMISHRA
    @DTMASUYASHMISHRA 2 ปีที่แล้ว

    Sir give some other practice problems for hw

  • @abhilashx0
    @abhilashx0 2 ปีที่แล้ว

    can anyone explain the l >=r, what is l>r?

  • @avishekdastidar7646
    @avishekdastidar7646 2 ปีที่แล้ว

    solved this problem using recursion for the first time...

  • @SRV.77
    @SRV.77 2 ปีที่แล้ว

    😊😊😊Thank u bhaiya

  • @autodocofficial2161
    @autodocofficial2161 2 ปีที่แล้ว

    done bhaiya..completed

  • @mdiqbalhayat5420
    @mdiqbalhayat5420 ปีที่แล้ว

    class PalindromClass{
    public static void main(String args[]) {
    String input = "racecar";
    boolean result = PalindromClass.Palindrom(0, input.length()-1, input);
    System.out.println(result);
    }
    public static boolean Palindrom(int l, int r, String s) {
    if(l>=r) return true;
    if(s.charAt(l) != s.charAt(r)) return false;
    return Palindrom(l+1, r-1, s);
    }
    }

  • @amitranjeetjha1240
    @amitranjeetjha1240 2 ปีที่แล้ว

    Fraz bhai 🔥🔥

  • @prakharagarwal4933
    @prakharagarwal4933 2 ปีที่แล้ว +1

    Done✅

  • @laharimanda2691
    @laharimanda2691 2 ปีที่แล้ว

    Bhaiya I am submitting my codes in python language I am getting TLE errors in code studio platform the code was similar to the code which you posted in GitHub what I need to do please do reply

  • @abhishektripathi3113
    @abhishektripathi3113 2 ปีที่แล้ว

    How this function in 2nd iteration returning true ?It is not either the base case or the that false case(s[l]!=s[e])..how is it returning true?

  • @billionairesayss
    @billionairesayss 2 ปีที่แล้ว

    i have written this code but it is showing eroor in code studio:
    public static boolean isStringPalindrome(String s) {
    // Write your code here
    return isPalindromeHelper(0,s.length()-1,s);
    }

    public static boolean isPalindromehelper(int l,int r,String s){
    // base
    if(l>=r){
    return true;
    }
    if(s.charAt(l)!= s.charAt(r)){
    return false;
    }
    return isPalindromehelper(l+1,r-1,s);

    }

  • @deepakprajapat4956
    @deepakprajapat4956 2 ปีที่แล้ว

    sir , apko jo quation kara rahe ho uske bhe sheet banalena chahiya 👍👍👍👍

  • @akashreddyallam8536
    @akashreddyallam8536 2 ปีที่แล้ว

    Thanks!

  • @gurisingh91298
    @gurisingh91298 2 ปีที่แล้ว

    sir, is O(n/2) == O(n) ?(Time complexity here)

  • @oqant0424
    @oqant0424 2 ปีที่แล้ว +1

    I never thought palindrome can be done recursively too 😶
    I always used two pointer

  • @VinayakH
    @VinayakH 2 ปีที่แล้ว +1

    Class 5 done☑