#455 Average Age of Top Students
Calculate the average age of the top n students. Invalid strings may be provided in age and avg.
/**
* public class Student {
* public String name; // name
* public String age; // age is a number such as "30", "54".
* public String avg; // average grade is a floating-point number such as "4.6", "1.0". Grade range is from "1.0" to "5.0".
* }
*/
public class StudentUtils {
// Calculate the average age of the top n students.
public static double foo(List<Student> students, int n) {
...
}
}
Question review
Sign in to start the dialogue
The mentor keeps the context of the current question and your previous messages.
Sign in
Available with Premium
This is just one of the solutions available with Premium. And more:
- 250+ advanced lectures
- 1300+ practice exercises
- 500+ solutions to problems from real interviews
- Personalized Java Hub certificates
- Expanded access to the AI mentor