Question: How to create a method in java that removes all instances of the N largest values in the LinkedList. Because the values are Strings, you
How to create a method in java that removes all instances of the N largest values in the LinkedList. Because the values are Strings, you will need to use the String class compareTo method to compare the Strings
If the input value N is zero or negative, this method should simply return without any modifications to the LinkedList. The other elements in the LinkedList should not be modified and their relative order must not be changed.
For example: linked list is AA-BB-CC-DD, if i removeMaxValues(2), then it should remove CC and DD. If i removeMaxValues(1), then it shuld remove DD.
If the linked list is AA-BB-CC-DD-CC, if I removeMaxValues(2), then it should remove CC-DD-CC (removing all duplicate values that fulfill the requirement as well).
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
