subject
Computers and Technology, 31.12.2019 03:31 ehaynie

Even-odd operations given an array of non-negative integers, perform a series of operations until the array becomes empty. each of the operations gives a score, and the goal is to maximize the overall score, the sum of the scores from all operations. determine the maximum possible score after performing the operations on the array. all operations are 1-indexed, and are defined as follows: 1. for every odd-indexed operation, the score is the sum of all integers present in the array. 2. for every even-indexed operation, the score is the negative of the sum of all integers present in the array. 3. after every operation (odd or even), remove either the leftmost or the rightmost integer from the array. for example: let integerarray = [3, 6, 8] initial score = 0 the operations are as follows: 1. operation 1 is odd, so add the sum of the array to the score. score = 3 + 6 + 8 = 17 choose to delete the rightmost integer (i. e. 8), and now integerarray = [3, 6] 2. operation 2 is even, so subtract the sum of the array from the score. sum = 3 + 6 = 9 and score = 17 - sum = 17 - 9 = 8 choose to delete the leftmost integer (i. e. 3), and now integerarray = [6] 3. operation 3 is odd, so add the sum of the array to the score sum-hand score – 8i sum - 816 - 11 2. uperation 2 is even, so subtract the sum of the array from the score. sum = 3 + 6 = 9 and score = 17 - sum = 17 - 9 = 8 choose to delete the leftmost integer (i. e. 3), and now integerarray = [6] 3. operation 3 is odd, so add the sum of the array to the score. sum = 6 and score = 8 + sum = 8 + 6 = 14 only one element is left. it is both the leftmost and rightmost element, so delete it (i. e. 6), and now integerarray = [ ] the array is now empty, so no further operations are possible. the maximum possible score is 14. function description complete the function getmaximumscore in the editor below. the function must return the maximum possible score after performing all the operations. getmaximumscore has the following parameter: integerarray: an array of integers constraints • 1 s size of integerarray < 103 • 0 s integerarray[i] = 109

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 18:30
Which cultural aspect does this type of song best portray? a german polka dance
Answers: 1
question
Computers and Technology, 23.06.2019 07:50
Apython programming question: assume s is a string of lower case characters. write a program that prints the number of times the string 'bob' occurs in s. for example, if s = 'azcbobobegghakl', then your program should print number of times bob occurs is: 2
Answers: 3
question
Computers and Technology, 24.06.2019 05:30
Hey i really need some solving this problem: 1. encrypt this binary string into cipher text: 110000. include in your answer the formula the decoder would use to decrypt your cipher text in the format (coded answer) x n mod (m) = y & 2. decrypt this cipher text into a binary string: 106 you.
Answers: 2
question
Computers and Technology, 24.06.2019 16:30
Which program can damage your computer?
Answers: 1
You know the right answer?
Even-odd operations given an array of non-negative integers, perform a series of operations until th...
Questions
question
Social Studies, 05.05.2021 19:00
question
Mathematics, 05.05.2021 19:00
question
Social Studies, 05.05.2021 19:00
Questions on the website: 13722363