@feihcsim, coming back to this answer, I noticed we could take this a step further. If we want to, we could even eliminate the 2nd loop (and the use of mid) and set j equal to s.length - i while iterating over the entire array ( breaking at i >= j) (not that it effects our time complexity). This is how I, personally, write it in tests now days, but that is more of a matter of what is more readable.
It also seems that I mentioned returning false by default but it doesn't look like I am doing that here. Thank you for the kudos. Jer Crc Check Failed.
– Jan 18 at 17:07. Dell Wireless 1490 Dual-band Wlan Mini Card Vista.
C++ Program to Check Whether Given String is a Palindrome - This C++ program is used to demonstrate whether the given string is a palindrome or not.
Comments are closed.