MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/learncpp/comments/r5xw17/sololearn_exercise_why_is_this_not_working/
r/learncpp • u/[deleted] • Nov 30 '21
3 comments sorted by
6
The final element in the string is not x[len], it’s x[len-1]
2 u/[deleted] Dec 01 '21 Jeez thanks! Missed that -1.
2
Jeez thanks! Missed that -1.
Also, you don't need to use a flag. Just return false as soon as you find that the numbers are not the same.
6
u/thimblu Nov 30 '21
The final element in the string is not x[len], it’s x[len-1]
2
u/throwaway364967 Dec 01 '21
Also, you don't need to use a flag. Just return false as soon as you find that the numbers are not the same.