Ad
  • Default User Avatar

    Can you be a bit more specific in the description about what datatype the column "number" should be?

  • Custom User Avatar

    It probably should, but I believe that was not the point of your original remark.

  • Default User Avatar

    Perhaps this issue would benefit from being re-written with appropriate cases. It's a waste of time to work with inconsistent input, as the saying goes - "garbage in, garbage out." In reality, people work with actual data rather than just descriptions of it. When something goes wrong, it's necessary to provide the dataset that caused the issue. I find it amusing that many computer science challenges focus on "corner" cases. In my experience working on production problems, developers don't typically think about "corner" cases; they focus on addressing the specific problem at hand. While there may always be another "corner" case that arises, the sheer number of potential cases is unlimited, so the idea of covering them all is unrealistic.

  • Default User Avatar

    Maybe the default test should include result validation? :-)

  • Custom User Avatar

    I'm not aware of any errors. Correct solution passes tests just fine.

    Which test did fail for you with that 'expected result'?

    The default test - the only with the above dataset - doesn't include result validation.

  • Default User Avatar

    This problem contains the most retarded tests I have even seen. They should be re-written/fixed of this assignment should not be on this site.

  • Default User Avatar

    Is something wrong with the simple test?

    select * from visits;
    
    id	entry_time	exit_time
    1	2019-04-01 00:00:00 +0000	2019-04-03 00:00:00 +0000
    2	2019-04-08 00:00:00 +0000	2019-04-09 00:00:00 +0000
    

    The above obviously do not overlap, but the expected result is

    when_happened	visits_count
    2019-04-01 00:00:00 +0000	2
    
  • Default User Avatar

    10.0.0.0 is not a valid address, it is a network address.

  • Default User Avatar

    Good job! It seems like the only pure SQL solution that works.

  • Default User Avatar

    Not working for the following simple test:

     id | user_id | name
    ----+---------+------
      1 |       1 | a
      2 |       2 | b
      3 |       1 | b
      4 |       2 | a
    
  • Default User Avatar

    Not working for the following simple test:

     id | user_id | name
    ----+---------+------
      1 |       1 | a
      2 |       2 | b
      3 |       1 | b
      4 |       2 | a
    
  • Default User Avatar

    This is not working for the following simple test:

     id | user_id | name
    ----+---------+------
      1 |       1 | a
      2 |       2 | b
      3 |       1 | b
      4 |       2 | a
    
  • Default User Avatar

    Could the following test be added please?

     id | user_id | name
    ----+---------+------
      1 |       1 | a
      2 |       2 | b
      3 |       1 | b
      4 |       2 | a
    (4 rows)
    

    Expected result:

     user_id | name
    ---------+------
           1 | a
           2 | b
    
  • Default User Avatar

    This query does not return correct answer for the following test:

     id | user_id | name
    ----+---------+------
      1 |       1 | a
      2 |       2 | b
      3 |       1 | b
      4 |       2 | a
    (4 rows)
    
  • Default User Avatar

    This query is not working. To prove it, just remove id = 4 from the test data:

     id | user_id | name
    ----+---------+------
      1 |       1 | a
      2 |       2 | b
      3 |       1 | b
      5 |       2 | a
      6 |       1 | a
    

    The result will be:

     user_id | name
    ---------+------
           1 | a
           2 | a
    
  • Loading more items...