Thank you so much for going into details! It is extremely helpful!
@abugslife2461 Жыл бұрын
Very helpful! Thank you so much!
@rakshithgowdahc92502 жыл бұрын
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
@PortfolioCourses2 жыл бұрын
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. :-)
@sazzadhossen323 ай бұрын
very good and clear explaination
@christosvrettos82572 жыл бұрын
Great explanatory video!!
@PortfolioCourses2 жыл бұрын
Thank you very much Christos, I'm glad you enjoyed it! :-)
@Vichained2 жыл бұрын
Hey Kevin, could you do this exact examply but using stack allocation and vectors?
@PortfolioCourses2 жыл бұрын
I'm not sure, maybe one day! 🙂
@HowDoYouTurnThisOn_11 ай бұрын
which line of code checks if the two characters are the same?
@musicoomi10 ай бұрын
if (palindrome[i] != palindrome[palindrome.length() - i - 1])
@fovv37832 жыл бұрын
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++.
@PortfolioCourses2 жыл бұрын
Yes, it sounds like that approach would work too! :-)
@worst11332 ай бұрын
Thanks 😊
@urruuu84472 жыл бұрын
why did the text.length got divided by 2?
@PortfolioCourses2 жыл бұрын
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. 🙂
@urruuu84472 жыл бұрын
@@PortfolioCourses okayy thank youu so much for your reply
@PortfolioCourses2 жыл бұрын
You’re welcome! :-)
@merveilleuxguiradoumadji2902 жыл бұрын
thank you so much,that was very hard for me .
@PortfolioCourses2 жыл бұрын
You're welcome Merveilleux! 😀
@abdelhakmezenner28552 жыл бұрын
damn that was in my last exam of c programming 😂 it was so hard for me .. but now its a little bit easier
@PortfolioCourses2 жыл бұрын
I’m glad to hear this made it a bit easier Abdelhak! :-)
@gokulakrishnan9141 Жыл бұрын
Love you sooo much man❤
@PortfolioCourses Жыл бұрын
Haha thanks, love you right back ❤️
@waed58932 жыл бұрын
Thank you for video 👏 But if you can make video to check if we can make number palindrome after swaping their digits.
@PortfolioCourses2 жыл бұрын
Thank you for the video idea Waed, I will add that idea to my list of video ideas. :-)