You are viewing a single comment's thread. Return to all comments →
simple C++ code:
string larrysArray(vector<int> A) { int rev_count = 0; for (size_t i = 0; i < A.size() - 1; i++) { for (size_t j = i + 1; j < A.size(); j++) { if (A[i] > A[j]) { rev_count += 1; } } } return rev_count % 2 == 0 ? std::string("YES") : std::string("NO"); }
Seems like cookies are disabled on this browser, please enable them to open this website
Larry's Array
You are viewing a single comment's thread. Return to all comments →
simple C++ code: