Created
November 3, 2022 18:58
-
-
Save TarasMazepa/ce75683bf3eebcdf58f21a6e7a9aec38 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int pairedVal = values.front(); | |
int maxScore = 0; | |
for (int i = 1; i < values.size(); ++i) { | |
maxScore = max(values[i] + --pairedVal, maxScore); | |
pairedVal = max(values[i], pairedVal); | |
} | |
return maxScore; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment