My algorithm creates an event prototype which makes events for calanders. An event is made up of the three properties name, date, time. Name is a string, date is a list of numbers in respect to month/day/year, and time is a list of the starting hour and end hour. The Calander prototype takes in a list of events. The calander class has three methods, one to find the conflicts in the calander, one to check to see if the conflict is already in the list, and one to compare two events and check to see if they are in conflict. Finding the conflicts is made by comparing every event to every other event based on the same date and testing the time ranges by comparing them. The edge cases I needed to watch out for are when a conflict is already in the list to not re-add it to the conflicts list. I did this by making a method of the calander to check to see if a conflict event is already in the conflicts list. Another edge case is to make sure not to compare the same event with itself or else all of the events would be in conflict. This edge case is solved by making sure we dont compare the same two events in the for loop.
ksantaro/Interview
Folders and files
| Name | Name | Last commit date | ||
|---|---|---|---|---|