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

Поделиться
HTML-код
  • Опубликовано: 20 сен 2024
  • Solved a problem from leetcode.
    Problem Name:Shortest Palindrome
    Level:Hard
    Link to the problem: leetcode.com/p...
    Recommended: Watch it on 1.75x or 2x.

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

  • @shikharai-tl4vb
    @shikharai-tl4vb День назад +1

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

  • @eklavyacodinghub
    @eklavyacodinghub 17 часов назад

    thanks ma'am for making this concept so easy

  • @unclezee7369
    @unclezee7369 26 дней назад +1

    Best explanation so far

  • @avneedadhich9185
    @avneedadhich9185 Год назад +6

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

  • @anonymoustrolls7952
    @anonymoustrolls7952 День назад

    she just taught KMP, good explanation

  • @soumya_suman
    @soumya_suman 16 часов назад

    Thank You !!!

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

    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!!!

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

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

  • @abhishekverma7604
    @abhishekverma7604 11 месяцев назад +3

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

  • @Rahul-kw6zf
    @Rahul-kw6zf 3 месяца назад +1

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

  • @AdityaKumar-be7hx
    @AdityaKumar-be7hx 8 месяцев назад +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;

  • @ArnabBhadra02
    @ArnabBhadra02 День назад

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

  • @VishalYadav-gk1kg
    @VishalYadav-gk1kg 9 месяцев назад +2

    Very Nice Explanation Mam, Thank you !

  • @silent-st1no
    @silent-st1no 3 месяца назад +1

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

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

    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

  • @srikarsaini
    @srikarsaini 22 часа назад

    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".

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

    Understood💯❤

  • @Yourcodehelper
    @Yourcodehelper День назад

    todays daily problem

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

    thanks sister explained very well🙌🙌

  • @PankajKumar-pk9dm
    @PankajKumar-pk9dm 7 месяцев назад +1

    loved the approach and awesome explanation

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

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

  • @machans-203
    @machans-203 4 месяца назад +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 3 месяца назад +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

  • @hhcdghjjgsdrt235
    @hhcdghjjgsdrt235 5 месяцев назад +1

    You got one subscriber

  • @naive-fleek7420
    @naive-fleek7420 2 месяца назад +1

    you are soo smart

  • @ujwalchawla6721
    @ujwalchawla6721 6 месяцев назад +1

    keep going🤘

  • @hackingkingdom5634
    @hackingkingdom5634 10 месяцев назад +1

    Nice approach Helpful✋

  • @raviroy84
    @raviroy84 8 месяцев назад +1

    Clear explaination❤