Ad
  • Default User Avatar

    I am really sorry. The issue was in my solution.

  • Default User Avatar

    The tests pass randomly as the order of threads depends on their id which can vary

  • Default User Avatar

    It's not clear for me what happens on the 3rd cycle? All of them drink 4 cans of cola or they continue drinking 2 cans at once? Is this a correct queue?

    Sheldon, Leonard, Penny, Rajesh, Howard,
    Sheldon, Sheldon, Leonard, Leonard, Penny, Penny, Rajesh, Rajesh, Howard, Howard,
    Sheldon, Sheldon, Sheldon, Sheldon, Leonard, Leonard, Leonard, Leonard, Penny, Penny, Penny, Penny, ...

  • Default User Avatar

    If I am not mistaken // operator is in Python since 2.2... I found this in PEP 238

    Here are the changes 2.2 introduces:

    A new operator, //, is the floor division operator. (Yes, we know it looks like C++'s comment symbol.) // always performs floor division no matter what the types of its operands are, so 1 // 2 is 0 and 1.0 // 2.0 is also 0.0.
    
    // is always available in Python 2.2; you don't need to enable it using a __future__ statement. 
    
  • Default User Avatar

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