subject

Write a function: class Solution { public int solution (int) A); }
that, given a zero-indexed array A consisting of N integers representing the initial test scores of a row of students, returns an array of integers representing their final test scores in the same order).
There is a group of students sat next to each other in a row. Each day, students study together and take a test at the end of the day. Test scores for a given student can only change once per day as follows:
• If a student sits immediately between two students with better scores, that student's score will improve by 1 when they take the test.
• If a student sits between two students with worse scores, that student's test score will decrease by 1.
This process will repeat each day as long as at least one student keeps changing their score. Note that the first and last student in the row never change their scores as they never sit between two students.
Return an array representing the final test scores for each student once their scores fully stop changing. Test Ou
Example 1:
Input: (1,6,3,4,3,5]
Returns: (1,4,4,4,4,5]
On the first day, the second student's score will decrease, the third student's score will increase, the fourth student's score will decrease by 1 and the fifth student's score will increase by 1, i. e. (1,5,4,3,4,5). On the second day, the second student's score will decrease again and the fourth student's score will increase, i. e. (1,4,4,4,4,5). There will be no more changes in scores after that.

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 17:00
Your company has 1,500 desktop computers running windows 7. you want to upgrade them to windows 10. which type of microsoft license would be best suited in this situation?
Answers: 3
question
Computers and Technology, 22.06.2019 20:00
Need asap assignment directions: think of an organization (business, religious institution, volunteer organization, sports team) with which you have been involved. imagine outfitting it with an it infrastructure. prepare a plan for what you would do to support outfitting it. draw a map of a network connecting all the individuals, give them pcs and printers, and lay out the design as best you can. the purpose is to begin working with these concepts, not to build a perfect network.
Answers: 2
question
Computers and Technology, 23.06.2019 16:30
How to do this programming flowchart?
Answers: 3
question
Computers and Technology, 24.06.2019 08:10
Where are american poets found in the dewey decimal system
Answers: 1
You know the right answer?
Write a function: class Solution { public int solution (int) A); }
that, given a zero-indexe...
Questions
question
Chemistry, 25.10.2020 19:00
question
Mathematics, 25.10.2020 19:00
question
English, 25.10.2020 19:00
Questions on the website: 13722361