Count representatives after comparison ties

A scheduling application inserts five distinct Job objects into an initially empty ordered set. The set keeps one representative whenever two objects compare as zero. No objects are removed or modified.


Each job's compareTo method compares only its integer duration in minutes, using ascending order. The jobs have durations 11 min, 7 min, 11 min, 16 min, and 7 min. Their identifiers are all different, and equals compares identifiers only.


How many objects remain in the set after all insertions? Answer in objects, as an exact integer with zero decimal places.

Create a free account to get started

Unlock full course notes by signing up

  • Video lessons taught by top educators
  • Practice questions with guided solutions
  • Written review notes for reference
  • Expert answers anytime from course tutors

More Comparable Questions: