Ad
  • Default User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Default User Avatar

    well if you import the whole library like this solution your program gets a little bit slow and when your working on a large project libraries are the most efficient way.

  • Custom User Avatar

    Thanks benjaminzwhite, your explination helped me.

  • Default User Avatar

    Ah, yes, I hadn't accounted for there already been somebody at the till. Cheers

  • Default User Avatar

    Draw a picture - look up "Gantt chart" or "scheduling diagram" - represent time horizontally and create a row for register machine #1 and create a row for register machine #2.

    Now, when 1st person arrives, let's say they go to (available) machine #1. Draw a horizontal bar of time = 2 units in row for machine #1.

    When 2nd person arrives, they go to the only available machine, which is #2. Draw a horizontal bar of time = 3 units in row for machine #2.

    When 3rd person arrives, both register machines are occupied, so they wait until any machine becomes available. This in our case will be machine #1, since 1st person will finish in 2 minutes, while 2nd person will finish in 3 minutes. So draw a horizontal bar of time = 10 units, representing 3rd person, in row for machine #1.

    Now look at your drawing and see how long the longest horizontal line is.

  • Default User Avatar

    Can this be explained please?

  • Default User Avatar

    Bro I missed that too:-)

  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar

    can any one explain the third example in problem description code
    queueTime([2,3,10], 2)
    // should return 12
    I didn't get it, how it return 12 plz explain

  • Custom User Avatar

    oh! right, thankyou so much, how did I miss that 🤦‍♂️

  • Custom User Avatar

    This range goes from "minus 3" to "plus 1" so "-3-1" in the sample solution is correct!

  • Custom User Avatar

    why no?
    solution([-10, -9, -8, -6, -3, -2, -1, 0, 1, 3, 4, 5, 7, 8, 9, 10, 11, 14, 15, 17, 18, 19, 20])
    this should return
    returns "-10--8,-6,-3--1,3-5,7-11,14,15,17-20"
    but returns returns "-10--8,-6,-3-1,3-5,7-11,14,15,17-20"

    the -3--1
    is just given -3-1
    instead of saying just no , could you explain?

  • Custom User Avatar

    No.

  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar

    actually my code is lot longer and more basic looking than this one, but took less time to execute, just saying.
    but I like the use of libraries too, but we can't predict some times if it can be efficent

  • Loading more items...