214.Shortest Palindrome || Leetcode || Solved&Explained || C++

Поділитися
Вставка
  • Опубліковано 10 лис 2024

КОМЕНТАРІ • 35

  • @avneedadhich9185
    @avneedadhich9185 Рік тому +6

    My search for it's solution finally came to an end . Thanks for such a great explanation .

  • @shikharai-tl4vb
    @shikharai-tl4vb Місяць тому +1

    you tried well Understanding a problem and effectively explaining it to others are two entirely different skills.

  • @abhishekverma7604
    @abhishekverma7604 Рік тому +3

    thanks for the algorithm,since code part is way too easy and self implementable...

  • @AdityaKumar-be7hx
    @AdityaKumar-be7hx 10 місяців тому +1

    Great explanation! Only tip is we can reuse the "t" variable instead of creating a new shorter string.
    return t.substr(0, s.size()-i)+s;

  • @ujwalchawla6721
    @ujwalchawla6721 8 місяців тому +1

    keep going🤘

  • @VishalYadav-gk1kg
    @VishalYadav-gk1kg 10 місяців тому +2

    Very Nice Explanation Mam, Thank you !

  • @materialscience8301
    @materialscience8301 Рік тому +4

    thanks for make it.
    your explanation is very well 😊😊
    i hope you will continue ..& grow

  • @eklavyacodinghub
    @eklavyacodinghub Місяць тому

    thanks ma'am for making this concept so easy

  • @Rahul-kw6zf
    @Rahul-kw6zf 5 місяців тому +1

    Finally After 2 days got h pretty good solution!!
    Understood❤

  • @satyamaditya384
    @satyamaditya384 3 місяці тому

    Thank you ma'am for such a great explanation, I had been struggling with KMP too, but now concepts are crystal clear. Thanks a lot!!!

  • @anonymoustrolls7952
    @anonymoustrolls7952 Місяць тому

    she just taught KMP, good explanation

  • @priyanshupriyam174
    @priyanshupriyam174 3 місяці тому

    Thanks a lot ma'am, cleared my kmp concepts well.

  • @unclezee7369
    @unclezee7369 2 місяці тому +1

    Best explanation so far

  • @PankajKumar-pk9dm
    @PankajKumar-pk9dm 8 місяців тому +1

    loved the approach and awesome explanation

  • @shh442
    @shh442 2 місяці тому

    class Solution:
    def shortestPalindrome(self, s: str) -> str:
    if s == s[::-1]:
    return s

    n = len(s)
    # Loop to find the largest palindrome prefix
    for i in range(n, 0, -1):
    if s[:i] == s[:i][::-1]:
    break

    # Add the reverse of the suffix to the start of the string
    suffix = s[i:]
    return suffix[::-1] + s

  • @ss8273
    @ss8273 Рік тому +2

    thanks sister explained very well🙌🙌

  • @silent-st1no
    @silent-st1no 5 місяців тому +1

    very very good explanation, thank you so much you are the great❤

  • @ArnabBhadra02
    @ArnabBhadra02 Місяць тому

    Is it possible to solve
    Using longest common substring between s and rev(s) and after that return the total length -s

  • @hackingkingdom5634
    @hackingkingdom5634 Рік тому +1

    Nice approach Helpful✋

  • @hhcdghjjgsdrt235
    @hhcdghjjgsdrt235 6 місяців тому +1

    You got one subscriber

  • @soumya_suman
    @soumya_suman Місяць тому

    Thank You !!!

  • @path8799
    @path8799 4 місяці тому +2

    Understood💯❤

  • @naive-fleek7420
    @naive-fleek7420 4 місяці тому +1

    you are soo smart

  • @Yourcodehelper
    @Yourcodehelper Місяць тому

    todays daily problem

  • @machans-203
    @machans-203 6 місяців тому +1

    But it doesn't pass all test cases.. for string "aabba" the ans is "abbaabba" how is it possible
    And also, "abb" -> ans: "bbabb"

    • @harmankour1711
      @harmankour1711 5 місяців тому +1

      because given is we are allowed to add in the front only
      and it is passing all the test case just check your code again

  • @VivekSharma-sk3vp
    @VivekSharma-sk3vp Місяць тому

    Memory Limit Exceeded!!😭😭

  • @raviroy84
    @raviroy84 9 місяців тому +1

    Clear explaination❤

  • @srikarsaini
    @srikarsaini Місяць тому

    10:06 Here we should not increment "j". There is a mistake in explanation. Check the code we are not incrementing "j" there in else statement. we are only changing the pointer "i".