Feature #5: Find Common Meeting Times

Sumit Rawal answered on May 24, 2023 Popularity 1/10 Helpfulness 1/10

Contents


More Related Answers

  • Feature #1: Find Meeting Rooms
  • Feature #3: Check if Meeting is Possible
  • Feature #4: Schedule a New Meeting

  • Feature #5: Find Common Meeting Times

    0

    Here is how we will implement this feature:

    We will use two indices, i and j, to traverse both of the meeting schedules, meetingsA and meetingsB, respectively.

    The indices i and j will both be zero at the beginning.

    Next, we will check if meetingsA[i] and meetingsB[j] overlap by comparing the start and end times.

    If the times overlap, the overlapping time interval will be added to the resultant list.

    Otherwise, we will keep incrementing the indices depending upon the end time of the next meeting. This means that if the next meeting in meetingsA ends before the next meeting in meetingsB we will only increment i. This is because the current meeting in meetingsB has the possibility to overlap with the next meeting. Similarly, vice versa is also true in case of incrementation in j.

    Scala 

    Popularity 1/10 Helpfulness 1/10 Language scala
    Source: Grepper
    Tags: find scala
    Link to this answer
    Share Copy Link
    Contributed on May 24 2023
    Sumit Rawal
    0 Answers  Avg Quality 2/10


    X

    Continue with Google

    By continuing, I agree that I have read and agree to Greppers's Terms of Service and Privacy Policy.
    X
    Grepper Account Login Required

    Oops, You will need to install Grepper and log-in to perform this action.