We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
void std::reverse<class Iterator>(Iterator begin, Iterator end) is an in-place iterator-based swap and overkill because it makes sense only in one of the two contexts:
Beautiful Days at the Movies
You are viewing a single comment's thread. Return to all comments →
void std::reverse<class Iterator>(Iterator begin, Iterator end)
is an in-place iterator-based swap and overkill because it makes sense only in one of the two contexts:string s1 = to_string(x); string s2 = s1 /* copy */; reverse(s2.begin(), s2.end()); if (s1 == s2) ...
as above but you use a function that converts an
int
to avector<int>
where each element is a digit then do the same process as with the stringsBoth are horrendous overkill compared to the multiply-modulo-add-divide loops in other answers.