Ad
  • Custom User Avatar

    Test cases like computing n^k and compute factorial does not check whether solution handles invalid cases by throwing error first before actually try doing the calculation with try-except. Also, there are better ways to test this behavior than using try-except.

  • Custom User Avatar

    It's not a performance issue you're having. Try throwing error when there are invalid case (len(stack) <= 2 for example). This is an issue with the test case.

  • Custom User Avatar

    The author asks you to find the maximum sum of contiguous subsequence in a list, not to generate all possible contiguous subsequence and find the max sum between all those generations.

    Both leads to the same conclusion, yes. But what is required to complete the task can differ.

    Ask yourself, if you want to calculate the sum of 1 million 3s, do you make a loop that will add to a variable 1 million times? That would be slow, instead we can just do 1_000_000 * 3. The same logic can be applied here. You just need to find the same result using a different and faster algorithm.

    My suggestion would be to just skip the kata if you don't know how to solve this yet, you can come back later.

  • Custom User Avatar

    In Task section:

    Write under the folder file a csv named output.csv in the format below

    Folder should be files not file

  • Custom User Avatar

    I vote for 5kyu + Voile's suggestion.

  • Custom User Avatar

    Based on the rank assessment votes, this shouldn't be approved at 4kyu.

    Votes: https://www.codewars.com/api/v1/code-challenges/5fe399429f548e0023d5c816/assessed-ranks

  • Custom User Avatar
    1. Expected result in tests differs from the description.
      From the description: A tuple containing 2 items. The count of unique combinations and the actual combinations
      In tests: Only the actual combinations

    2. The number of items will always be even (so splitting is always possible).

      This is not true for the k=1 test

    3. No random tests

  • Custom User Avatar

    The second and fourth characters must be uppercase letters, excluding I, O, and Q.

    Tests expect that Q is not excluded. So, this statement is not true.

  • Custom User Avatar

    Last random tests describe block has wrong name (Should be Large / Big not Small).

  • Custom User Avatar

    :)

  • Custom User Avatar

    Yup, it's fixed.

  • Custom User Avatar

    In the tests:

    function randomMoves(tape_len, pos, len) {
      const result = [];
      while (result.push(randomChoice(allowedMoves(tape_len, pos))) < len);
      return result.join('').replace(/\-1/g, '<').replace(/1/g, '>');
    }
    

    I suggest changing the code into something more readable, as it won't only be you maintaining the code once this gets published.

  • Custom User Avatar

    The moves in javascript can lead to positions outside of the tape:

  • Custom User Avatar

    The message 2 should equal 1 refers to a previous test your code fails on:

    As you can see above, your code returns 2 for input 00101.

  • Custom User Avatar

    No, both should be 2. Are you sure that's the candles the tests gave?

  • Loading more items...