6 kyu

Triple Sorting - Sort & Stringify a list by 3 attributes

457 of 775pojo

Description:

Tale University is a bit messy, and can't maintain an ordered list of their student. Tale's dean wants to print a sortet list of his students by the gpa, last name and age and post it on the walls so everybody can be impressed of his great students.

Given a list of students, sort them by (from most important to least important):

  • GPA (descending)
  • First letter of last name (ascending)
  • Age (ascending)

And the class Student:

class Student {
    ...
  int getGpa()
  int getAge();
  String getFullName();
}
class Student {
  constructor(age, gpa, fullName) {
    this.age = age;
    this.gpa = gpa;
    this.fullName = fullName;
  };
};

Return the sorted result as full names string, comma separated.

For Example, given the list (name, age, gpa):

  • David Goodman, 23, 88
  • Mark Rose, 25, 82
  • Jane Doe, 22, 90
  • Jane Dane, 25, 90
sort(students) should return "Jane Doe,Jane Dane,David Goodman,Mark Rose"
Streams
Strings
Algorithms
Arrays
Sorting

Stats:

CreatedNov 14, 2016
PublishedNov 14, 2016
Warriors Trained1703
Total Skips60
Total Code Submissions5433
Total Times Completed775
Java Completions457
JavaScript Completions325
Total Stars42
% of votes with a positive feedback rating90% of 137
Total "Very Satisfied" Votes112
Total "Somewhat Satisfied" Votes22
Total "Not Satisfied" Votes3
Total Rank Assessments10
Average Assessed Rank
6 kyu
Highest Assessed Rank
5 kyu
Lowest Assessed Rank
7 kyu
Ad
Contributors
  • pojo Avatar
  • janitormeir Avatar
  • smile67 Avatar
Ad