You are viewing a single comment's thread. Return to all comments →
C++ solution. Remember arr is 1-indexed
vector<string> solve(vector<int> arr, vector<vector<int>> queries) { vector<string> ans; for (auto q : queries){ if (arr[q[0]-1] %2 != 0) ans.push_back("Odd"); else { if (q[1] > q[0] && arr[q[0]] == 0) ans.push_back("Odd"); else ans.push_back("Even"); } } return ans; }
Seems like cookies are disabled on this browser, please enable them to open this website
Even Odd Query
You are viewing a single comment's thread. Return to all comments →
C++ solution. Remember arr is 1-indexed