Тёмный

93 - Palindrome Index | Strings | Hackerrank Solution | Python 

Hackers Realm
Подписаться 25 тыс.
Просмотров 13 тыс.
50% 1

⭐️ Content Description ⭐️
In this video, I have explained on how to solve palindrome index using list slicing and simple comparison in python. This hackerrank problem is a part of Problem Solving | Practice | Algorithms | Strings | Palindrome Index and solved in python. The complexity of this solution is O (n).
HackerRank Python Solution Files: shorturl.at/xldmm
🔔 Subscribe: bit.ly/hackersr...
🗓️ 1:1 Consultation with Me: calendly.com/h...
📷 Instagram: / aswintechguy
🔣 Linkedin: / aswintechguy
🎯 GitHub: github.com/asw...
🎬 Share: • 93 - Palindrome Index ...
😎 Hackerrank problem solving solutions playlist: bit.ly/hackerra...
🤖 ML projects tutorial playlist: bit.ly/mlprojec...
🐍 Python tutorial playlist: bit.ly/python3p...
Make a small donation to support the channel 🙏🙏🙏:-
🆙 UPI ID: hackersrealm@apl
💲 paypal: paypal.me/hack...
#palindromeindex #howtosolve #hackerrank #hackerranksolutions #hackersrealm #python #strings #problemsolving #tutorial #algorithms #datastructures #programming #coding #codinginterview #education #aswin

Опубликовано:

 

27 окт 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 26   
@marburymou
@marburymou 2 года назад
I googled many solutions and never understood until seeing this video. You are god-like.
@HackersRealm
@HackersRealm 2 года назад
Glad it was helpful!!!
@hr44444
@hr44444 3 года назад
The way you make it easy is amazing 🔥🔥 keep it up
@matthewking8468
@matthewking8468 3 года назад
Hi, have you tried solving this challenge for the Hacker rank one week preparation mock test? It fails on hidden cases 12 and 13 and I have no idea why. On the discussion someone suggest there is an issue with tests? |Thanks for your video's. Very well explained step-by-step which is essential for a full understanding, and explained in a timely fashion, very good indeed.
@matthewking8468
@matthewking8468 3 года назад
Day 3 I believe
@HackersRealm
@HackersRealm 3 года назад
Glad you liked the video!!! Is the testcase failing now also with the same code as in the video?
@matthewking8468
@matthewking8468 3 года назад
@@HackersRealm It is yes, it passes the majority but fails on 12 and 13. This is only for the mock test of the 7 day preparation course on Hacker Rank. It passes all tests on the standard palindrome challenge page. Just wondered if you had encountered it. I read the discussion and people mentioned poor test cases. Was just interested to see if you'd encountered/solved this issue. Many thanks.
@HackersRealm
@HackersRealm 3 года назад
@@matthewking8468 Sometimes, there will be issues in hackerrank, I faced similar issues while solving problems
@lofibeatz990
@lofibeatz990 2 года назад
@@matthewking8468 try this left=0 right=len(s)-1 index=-1 def palindrome(s): if(s==s[::-1]): return True else: False while(left
@sebastian-nunez
@sebastian-nunez Год назад
I decided to break up the problem into 2 functions but it's basically the same thing but more intuitive to read. Also, I used a 2 pointer approach instead of the reversing the string trick (this can result in an "early return" out of the function) def is_palindrome(s): if not s: return False low = 0 high = len(s) - 1 while low < high: if s[low] != s[high]: return False low += 1 high -= 1 return True def palindromeIndex(s): if not s or is_palindrome(s): return -1 low = 0 high = len(s) - 1 while low < high: if s[low] != s[high]: removed_low = s[:low] + s[low+1:] if is_palindrome(removed_low): return low removed_high = s[:high] + s[high + 1:] if is_palindrome(removed_high): return high low += 1 high -= 1 return -1
@brianthomas9148
@brianthomas9148 Год назад
very good explanation!
@HackersRealm
@HackersRealm Год назад
Glad you liked it!!!
@sonymouna
@sonymouna Год назад
there's an error in your code. try case aabdadacaa. your should add else: return -1 after if elif. But good explanation, correct logic, keep up the good work!
@jm.sarmiento
@jm.sarmiento Год назад
You're a Pro bro. Thanks!
@HackersRealm
@HackersRealm Год назад
Glad you liked it Jose!!! Happy learning!!!
@hongbo-wei
@hongbo-wei Год назад
Well explained! : )
@HackersRealm
@HackersRealm Год назад
Glad you liked it!!!
@jabahuntercrypto
@jabahuntercrypto Год назад
Nice
@ballkrishnaj2757
@ballkrishnaj2757 2 года назад
Thank you so much sir
@HackersRealm
@HackersRealm 2 года назад
Glad it was helpful!!!
@YoSoyWerlix
@YoSoyWerlix 2 года назад
Hi, could you please upload the approach for the solution to the flipped matrix on hacker rank?
@HackersRealm
@HackersRealm 2 года назад
I will try, which section it belongs to?
@omkulkarni6557
@omkulkarni6557 2 года назад
@@HackersRealm Interview Preparation -> Week 1
@vitaliisili
@vitaliisili Год назад
def palindromeIndex(s): if s[::-1] == s: return -1 for i in range(len(s)): origin = s[:i] + s[i + 1:] revers = origin[::-1] if origin == revers: return i else: return -1 This work fine but hackerrank test do not accept this for example test: "fvyqxqxynewuebtcuqdwyetyqqisappmunmnldmkttkmdlnmnumppasiqyteywdquctbeuwenyxqxqyvf" there are two possibilities remove index 24 "q" or index 25 "q" this code remove index 24 but hackerrank test check only for index 25 and it's wrong test should check for both possibilities
@Shams_
@Shams_ Год назад
The code fails this test case : s = "ghdjieta"
Далее
Extra Characters in a String - Leetcode 2707 - Python
21:11
Repeated String  [HackerRank] | Python | Interview
9:44
Palindrome Index | HackerRank (JavaScript)
7:17
String Slicing in Python (Part 1)
16:57
Просмотров 42 тыс.
Hackerrank: Palindrome Index Problem
11:12
Просмотров 2 тыс.
Python 101: Learn the 5 Must-Know Concepts
20:00
Просмотров 1,2 млн