Problem 1:(50 points) The XYZ daycare has installed a new high-tech system for k
ID: 3572109 • Letter: P
Question
Problem 1:(50 points)
The XYZ daycare has installed a new high-tech system for keeping track of which children are
under its supervision at any moment in time. Each parent of a child has a card with a unique ID, where
the ID is some integer x. Every morning, the parent swipes the card at a card-reader when dropping their
child off at the daycare. The system then adds x to an array of integers. In the evening, when the parent
comes to pick up the child, the same card is swiped, and a second copy of x is added to the list. Each
night at midnight, the array is wiped clean and reset to have zero elements. In this way, the daycare can
quickly check every afternoon which children are yet to be picked up by their parents by picking out the
array elements that occur precisely once. Unfortunately, at 4:55 pm on Thursday, December 1, 2016, the
daycare realizes that somewhere in their daycare is precisely one child who is yet to be picked up - can
you help them determine the integer ID of this child?
Requirements:
1. The file name must be named as Problem1.java
2. Write a static method as specified in the following method header
public static int checkIDs(int[] idMapping)
Input: The input consists of two rows. On the first row, an integer n satisfying 1<= n <= 10,000 is given. On the
second row, a sequence of n integers is given.
Output: The ID of the child left in the daycare.
Sample Inputs
7
1 1 2 9 -11 -11 9
9
1 2 1 3 2 4 3 4 5
Sample Outputs
2
5
Explanation / Answer
Please find the required program along with its output. Please see the comments against each line to understand the step.
----------------------------------
OUTPUT:
2
5