Description
Submission
class Solution { public: int maxScoreSightseeingPair(vector<int>& values) { int n = values.size(); int ret = 0; int maxi = 0; for(int i = 0; i < n; ++i) { if(i > 0) ret = max(ret, maxi + values[i] - i); maxi = max(values[i] + i, maxi); } return ret; } }; // values[i] + i + values[j] - j