Sorted List of Visitors Log

  • 0

    Write a program to print the visitors log in a sorted order of a particular place.
    You are given unsorted log list of visitors, place open time and close time. You may assume that always Visitor Check-in time is always before check out time, also visitor check-in and check-out time will be between the open and close time of a place. When there's no visitor for any time slot include "No Visitor <time_slot>" to the list. Time complexity should be less than O(n^2)

    Eg. Museum operation hours - 10AM to 5PM
    Sam -> 3PM to 4PM
    Paul -> 10:15AM to 12PM
    Swag -> 11AM to 1:30PM

    Output should be
    No Visitor 10AM to 10:15AM
    Paul 10:15AM to 12PM
    Swag -> 11AM to 1:30PM
    No Visitor 1:30PM to 3PM
    Sam-> 3PM to 4PM
    No Visitor 4PM to 5PM

Log in to reply

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.