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:10
How can i delete permalinks from a word press site?
Answers: 1
question
Computers and Technology, 22.06.2019 19:00
How is the number 110 written when expanded out to place values in the base 2 (binary) number system? options: 2 x 4 + 3 x 2 + 4 x 1 1 x 2 + 1 x 2 + 0 x 2 1 x 100 + 1 x 10 + 0 x 1 1 x 4 + 1 x 2 + 0 x 1
Answers: 1
question
Computers and Technology, 23.06.2019 14:00
Select the correct answer. andre was recently hired by an organization to check for system vulnerabilities. he is supposed to exploit these vulnerabilities and create a report on the extent of damage to which the system was susceptible. what position does andre hold in this organization? a. information security analyst b. information assurance manager c. penetration tester d. network security engineer e. chief information security officer
Answers: 2
question
Computers and Technology, 23.06.2019 22:30
Janice usually works on a particular workbook that contains all business related data. she decides to keep a backup of all the data in a separate workbook. she opens a new workbook to transfer the data. which option should she use to copy all the data from one workbook to another workbook?
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
Mathematics, 04.09.2020 21:01
question
Mathematics, 04.09.2020 21:01
question
Mathematics, 04.09.2020 21:01
question
Mathematics, 04.09.2020 21:01
Questions on the website: 13722367