HackerRank - Almost Sorted
I find the reverse iterators a bit confusing, but I might be a little slow. That said, I'm probably not the only one, so you wouldn't waste your time looking for a simpler way to express yourself.

I'd add that you forgot to handle the case where the input is already sorted, meaning that you could have been overwhelmed yourself ;-)

My suggestion, using std::adjacent_find to detect sign changes (note that I use a reverse iterator only once, to denote the vector's last element -in that case it feels intuitive to me):

#include &lt;iostream&gt;
#include &lt;vector&gt;
#include &lt;algorithm&gt;
#include &lt;functional&gt;

void is_almost_sorted(std::vector&lt;int&gt;&amp; vec) {
    // find swap candidates, swap and check if sorted
    auto first  = std::adjacent_find(vec.begin(), vec.end(), std::greater&lt;int&gt;()); // first sign change... 
    if (first == vec.end()) {
        std::cout &lt;&lt; "Already sorted";
        return;
    }
    auto bkp = vec;
    auto second = std::adjacent_find(first+1, vec.end(), std::greater&lt;int&gt;()); // and second
    if (second != vec.end() 
        &amp;&amp; (std::iter_swap(first, second+1), std::is_sorted(vec.begin(), vec.end()))) {
        std::cout &lt;&lt; "swap " &lt;&lt; *first &lt;&lt; " and " &lt;&lt; *++second;
        return;
    }
    // restore from original vec
    auto offset = std::distance(vec.begin(), first);
    vec = std::move(bkp);
    first = vec.begin()+offset;
    // find inverse change of signs, reverse and check if sorted
    second = std::adjacent_find(first+1, vec.end(), std::less&lt;int&gt;());
    std::reverse(first, second == vec.end() ? second : second + 1);
    if (std::is_sorted(vec.begin(), vec.end())) {
        std::cout &lt;&lt; "reverse from " &lt;&lt; *first 
                  &lt;&lt; " to " &lt;&lt; (second == vec.end() ? *std::rbegin(vec) : *++second);
        return;
    }
    std::cout &lt;&lt; "no solution";
}