Ad
  • Custom User Avatar

    Your code is not a correct solution for this problem. Your type declaration is not a valid TypeScript type (it is not allowed to write M + 1 for generic parameters). It passes Sample Tests because the TypeScript Codewars setup is very lenient and it allows incorrect types by replacing them with Any. Real tests are much stricter and that's why your solution fails them.

    I improved Sample Tests (now your solution does not pass them).

  • Custom User Avatar

    I can pass the tests, but when I "attempt" I get the following error:

    test.ts:14:15 - error TS2322: Type 'boolean' is not assignable to type '["Add<0, 5> should be 5", "Actual type: ", any]'.
    14         const t2: Test<0, 5, 5> = true;
    
    ... and so on ...
    

    Am I doing something wrong or the Test is actually incompatible with my solution?

  • Custom User Avatar

    Thanks for unpublishing. I really am sorry.

    There is a Discord server with a #kata-ideas channel where you can ask if things have been done before ( some people have better memory than CW has search function ). That would have saved you quite a bit of time.

    Note that the original kata does not have a TS translation. You could add that - solving it in Haskell or JS should not be a problem ..

  • Custom User Avatar

    yes yours looks better

  • Custom User Avatar

    You're right. Although I'd argue my problem has better wording.

  • Custom User Avatar

    wait, that might be the duplicate you are talking about

  • Custom User Avatar

    I've searched a bit before published and failed to find similiar katas. Can you please link original kata?

  • Custom User Avatar

    This is definitely a duplicate. Something with rain.

    Please unpublish this kata.

  • Custom User Avatar

    What is the best time complexity one could achieve? Mine is O(n^(3/2)) and I still couldn't make it through the time limits.