Skip to main content

AP CSA FRQ Guide

2006 FRQ 1: DailySchedule

Detect overlapping appointments, remove every conflicting entry from a daily schedule, and add appointments according to whether they are emergencies.

Appointment Conflicts and List Mutation22 minute targetArrayListobjectshelper methodsremovallegacy raw types

Skills Tested

What this FRQ is really practicing

ArrayListobjectshelper methodsremovallegacy raw types

Review these topics before attempting the problem.

Starter Approach

How to begin with your own plan

  1. 1Part A: use getTime and overlapsWith to determine whether two appointments conflict.
  2. 2Part B: remove every conflicting appointment, taking care not to skip entries after a removal.
  3. 3Part C: clear conflicts before adding an emergency appointment; add a nonemergency appointment only when no conflict exists.
  4. 4Return whether an appointment was added, and leave the schedule unchanged when a nonemergency appointment is rejected.

Attempt the problem before opening the solution.

Common Mistakes

Mistakes to watch for while writing

Reimplementing overlap calculations instead of using the provided helper.
Skipping adjacent conflicting entries after removing from an ArrayList.
Clearing appointments when a nonemergency request should simply be rejected.

Self Check

Review questions before you submit

Uses the supplied interval-overlap helper.

Compare the two appointments through their TimeInterval objects.

Tests conflicts and removes matching list entries.

The supplied ArrayList is a raw type, so reading an Appointment requires a cast.

Reuses clearConflicts for an emergency appointment.

Emergency insertion can replace conflicting appointments.

Adds accepted appointments and reports success or failure.

Do not insert a nonemergency appointment before checking all conflicts.

Practice Links

Where to go next