Question: Teacher's Fun After correcting a test given to his students, a teacher was bored and wanted to know the maximum number of students that had

Teacher's Fun
After correcting a test given to his students, a teacher was bored and wanted to know the maximum number of students that had scores equal or close to others by a maximum of one point:
Considering an array of n scores, scores, a number m is defined as the size of some subsequence, s, of scores where each element covers an unbroken range of integers. That is to say, if you were to sort the elements in s, the absolute difference between any elements j and j+1 would be either 0 or 1. Determine the maximum length of a subsequence chosen from the scores array.
Example
scores =[8,5,4,8,4]
Valid subsequences, sorted, are {4,4,5} and {8,8}. These subsequences have m values of 3 and 2, respectively. Return 3.
Function Description
Complete the function maxSubsequence in the editor below.
Language Java 8
Autocomplete F
1> import
java.io.*;
class Result f
1**
Complete the 'maxsubsequence' function below.
The function is expected to return an INTEGER.
The function accepts INTEGER_ARRAY scores as parameter.
*1
pubtic static int maxsubsequence(List
 Teacher's Fun After correcting a test given to his students, a

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!