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 20:00
Which location-sharing service offers items for users as a gaming component and also allows them to collectively link their check-ins to publish a trip? a. whrrl b. buzzd c. foursquare (this option is wrong i already tried) d. gowalla for plato
Answers: 2
question
Computers and Technology, 23.06.2019 04:00
Another name for addicting games.com
Answers: 1
question
Computers and Technology, 23.06.2019 21:00
Which set of steps will organize the data to only show foods with more than 100 calories and rank their sugar content from greatest to least?
Answers: 1
question
Computers and Technology, 24.06.2019 00:50
Which of the following is not a key player in the sale of travel products?
Answers: 2
You know the right answer?
Write a function: class Solution { public int solution (int) A); }
that, given a zero-indexe...
Questions
question
Mathematics, 31.08.2019 10:50
Questions on the website: 13722360