13,911 views
31 votes
31 votes
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, April 20, 2017, 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

User Dan Mirescu
by
2.8k points

1 Answer

15 votes
15 votes

Answer:

Use or Add a log of the actions of the system including the integer, the action, and the time. Scroll through and see which integer was added but was not removed.

Step-by-step explanation:

I wouldn't be able to program this, but I think a log is the best solution for this.

User Phx
by
3.4k points