Ad
  • Custom User Avatar

    To make the challenges more challenging for me I'm aiming for minimal code instead of product quality code ;)

  • Custom User Avatar

    true, there should be a test case for that

  • Custom User Avatar

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

  • Custom User Avatar

    Default test in TypeScript is broken: Missing }); at the end.

  • Custom User Avatar

    This looks like the opposite of a singleton... Instead of always getting the same object by getInstance() here you always get a different one, but all share the same static counter value.

    In the end, SingletonCounter is not actually used as a class, but rather as container for the counter variable, which could as well just be a global variable in this case.

  • Custom User Avatar

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

  • Custom User Avatar

    Johnny would get two exclamation marks here, but luckily, his case is apparantly not even tested ;)

  • Custom User Avatar

    Wouldn't this yield the wrong result, if array[n] === 0 and n > 0?

  • Custom User Avatar

    Sample tests for TypeScript are broken:

    TSError: ⨯ Unable to compile TypeScript:
    test.ts:1:22 - error TS6053: File '/runner/typings/mocha/index.d.ts' not found.
    
    1 /// <reference path="/runner/typings/mocha/index.d.ts" />
                           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    test.ts:2:22 - error TS6053: File '/runner/typings/chai/index.d.ts' not found.
    
    2 /// <reference path="/runner/typings/chai/index.d.ts" />
                           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
  • Custom User Avatar

    I think the algorithm would be more effective (and easier to implement), if it wouldn't prioritize sequences of identical numbers over consecutive ones ;)

  • Custom User Avatar

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

  • Custom User Avatar

    I guess that the random tests are run asynchronously. Since they all use the same variables vor queues1, queues2 and liftMax that could explain why the are always the same for every run. I'd try moving the code in the for-loop into the function passed to it().

  • Custom User Avatar

    I guess the brackets won't work reliably if there are multiple of them, would them?

  • Custom User Avatar

    I fixed this by clearing the original queue arrays in the queues array given to the function, though it wasn't necessary for my algorithm to produce the correct result.

    But apparently the random test cases use the same queues array for each run and the sample solution clears it as well, logically producing the result [ 0 ] for every consecutive run (since there are no people wanting to go anywhere anymore).
    This behavior of the random test runs seems buggy to me, though, and should be fixed!

  • Custom User Avatar

    All test pass for my solution (TypeScript) except "NotAllowedCharTests". It always reports expected [Function] to throw an error...

    I definitely do execute throw new Error('Invalid character'); in that run, though. Did anyone else encounter this problem? Is a specific error expected?

  • Loading more items...