Check If A String Is A Palindrome | C++ Example

  Рет қаралды 37,454

Portfolio Courses

Portfolio Courses

Күн бұрын

Пікірлер
@rupertzoone3512
@rupertzoone3512 2 жыл бұрын
Clear and smooth explanation with good example.
@PortfolioCourses
@PortfolioCourses 2 жыл бұрын
Thank you for the kind feedback Rupert. :-)
@88NA
@88NA Жыл бұрын
this example is very well explained. thank you.
@PortfolioCourses
@PortfolioCourses Жыл бұрын
You're welcome, I'm glad you enjoyed it! :-)
@asthagothi7151
@asthagothi7151 Жыл бұрын
The only explanation i needed
@carsmiles4035
@carsmiles4035 Жыл бұрын
Thank you so much for going into details! It is extremely helpful!
@abugslife2461
@abugslife2461 Жыл бұрын
Very helpful! Thank you so much!
@rakshithgowdahc9250
@rakshithgowdahc9250 2 жыл бұрын
here in if statement can u explain the indexing how we did it?? because if text length is 10-1-1==8,how we are comparing is it the correct way what I calculated
@PortfolioCourses
@PortfolioCourses 2 жыл бұрын
Great question Rakshith! Remember that i starts off at 0. So if the length is 10 then we get 10 - 1 - i which is 10 - 1 - 0 which is then 9. And that would mean we are comparing the element at index 0 with the element at index 9, which is exactly what we want because (due to zero-indexing) the last char in the string will be at index 9. :-)
@sazzadhossen32
@sazzadhossen32 3 ай бұрын
very good and clear explaination
@christosvrettos8257
@christosvrettos8257 2 жыл бұрын
Great explanatory video!!
@PortfolioCourses
@PortfolioCourses 2 жыл бұрын
Thank you very much Christos, I'm glad you enjoyed it! :-)
@Vichained
@Vichained 2 жыл бұрын
Hey Kevin, could you do this exact examply but using stack allocation and vectors?
@PortfolioCourses
@PortfolioCourses 2 жыл бұрын
I'm not sure, maybe one day! 🙂
@HowDoYouTurnThisOn_
@HowDoYouTurnThisOn_ 11 ай бұрын
which line of code checks if the two characters are the same?
@musicoomi
@musicoomi 10 ай бұрын
if (palindrome[i] != palindrome[palindrome.length() - i - 1])
@fovv3783
@fovv3783 2 жыл бұрын
couldn't you add another empty string, then with for loop from back add reversed text to this empty string and then check if they are equal? I mean it is working in c# and i am not sure if you can do this in c++.
@PortfolioCourses
@PortfolioCourses 2 жыл бұрын
Yes, it sounds like that approach would work too! :-)
@worst1133
@worst1133 2 ай бұрын
Thanks 😊
@urruuu8447
@urruuu8447 2 жыл бұрын
why did the text.length got divided by 2?
@PortfolioCourses
@PortfolioCourses 2 жыл бұрын
Great question Urishita! 🙂 We want to compare the 1st element to the last element, the 2nd element to the 2nd last element and so on to see if all of the corresponding elements match. So we really only need our loop counter variable to go until the middle of the string. Once we reach the middle of the string, we will have compared the 1st element to the last, the 2nd element to the 2nd last element, and so on. We could go keep past the middle of the string, but we would just end up making the same comparisons again, so for example by the last run of the loop we would just e comparing the last element to the 1st element again. We save work by only checking up until the middle of the string as that is all that is required. 🙂
@urruuu8447
@urruuu8447 2 жыл бұрын
@@PortfolioCourses okayy thank youu so much for your reply
@PortfolioCourses
@PortfolioCourses 2 жыл бұрын
You’re welcome! :-)
@merveilleuxguiradoumadji290
@merveilleuxguiradoumadji290 2 жыл бұрын
thank you so much,that was very hard for me .
@PortfolioCourses
@PortfolioCourses 2 жыл бұрын
You're welcome Merveilleux! 😀
@abdelhakmezenner2855
@abdelhakmezenner2855 2 жыл бұрын
damn that was in my last exam of c programming 😂 it was so hard for me .. but now its a little bit easier
@PortfolioCourses
@PortfolioCourses 2 жыл бұрын
I’m glad to hear this made it a bit easier Abdelhak! :-)
@gokulakrishnan9141
@gokulakrishnan9141 Жыл бұрын
Love you sooo much man❤
@PortfolioCourses
@PortfolioCourses Жыл бұрын
Haha thanks, love you right back ❤️
@waed5893
@waed5893 2 жыл бұрын
Thank you for video 👏 But if you can make video to check if we can make number palindrome after swaping their digits.
@PortfolioCourses
@PortfolioCourses 2 жыл бұрын
Thank you for the video idea Waed, I will add that idea to my list of video ideas. :-)
@alexandrstrekalovskiy4083
@alexandrstrekalovskiy4083 2 жыл бұрын
Many thanks for video!
@PortfolioCourses
@PortfolioCourses 2 жыл бұрын
You're welcome Alexandr! :-)
@alshaimaahassan3512
@alshaimaahassan3512 2 жыл бұрын
Many thanks for video
@PortfolioCourses
@PortfolioCourses 2 жыл бұрын
You're welcome Alshaimaa! :-)
@yodakash6284
@yodakash6284 Жыл бұрын
fake!!!!!!
@PortfolioCourses
@PortfolioCourses Жыл бұрын
What? :-)
Singleton Design Pattern | C++ Example
13:24
Portfolio Courses
Рет қаралды 17 М.
Check If A String Is A Palindrome Using Recursion | C Programming Example
9:36
Гениальное изобретение из обычного стаканчика!
00:31
Лютая физика | Олимпиадная физика
Рет қаралды 4,8 МЛН
Правильный подход к детям
00:18
Beatrise
Рет қаралды 11 МЛН
REAL or FAKE? #beatbox #tiktok
01:03
BeatboxJCOP
Рет қаралды 18 МЛН
Check If A String Is A Palindrome | C Programming Example
10:56
Portfolio Courses
Рет қаралды 44 М.
Check String Is Palindrome Or Not
7:18
CppNuts
Рет қаралды 15 М.
Check If A Number Is Prime | C++ Example
8:29
Portfolio Courses
Рет қаралды 28 М.
Learn Any Programming Language In 3 Hours!
22:37
Code With Huw
Рет қаралды 639 М.
Check If A Number Is An Armstrong Number | C++ Example
10:12
Portfolio Courses
Рет қаралды 3,7 М.
you will never ask about pointers again after watching this video
8:03
Special Programs in C − Check If The Number Is Palindrome Number
8:14
Гениальное изобретение из обычного стаканчика!
00:31
Лютая физика | Олимпиадная физика
Рет қаралды 4,8 МЛН