Ad
  • Custom User Avatar

    I wouldn't consider the concept of odd and even numbers as university level math but ok.

  • Custom User Avatar

    This comment has been deleted.

  • Custom User Avatar

    This comment has been deleted.

  • Custom User Avatar

    Thank you mr replyguy, I am very well aware.

  • Custom User Avatar

    It's not that there are 8000 other katas to solve...

  • Custom User Avatar

    Literally cannot understand any sentence of this kata's description. Really wish this site was actually codewars and not puzzles for people who studied mathematics at university...

  • Custom User Avatar

    I just realized I totaly swapped left and right. You'd think I'd remember which one is left after 28 years...

  • Default User Avatar

    what about this ?

    The entries() method of Map instances returns a new map iterator object that contains the [key, value] pairs for each element in this map in insertion order.

  • Custom User Avatar

    This just barely passes the "cpu playing against itself" tests, but has a few known bugs:

    • it's unclear how to handle the win message should the player win with the move provided by the cpu
    • it's unclear if CPU and player permanently switch signs when the CPU provides a player move or if the method should force the next move() call to be for the CPU
    • it's possible for the player to perform two moves by providing a move after the CPU picked one for the player already
  • Custom User Avatar

    Next time I would prefer that instead of relying on implementation details such as ordered dicts/Maps you simply provide an array of tuplies (i.e. the result of functions.entries() in JS). the V8 engine happens to also have ordered Maps and Sets, but that is not guranteed to happen in other JS engines.

  • Custom User Avatar

    for anyone solving this currently and confused by this edgecase: The solver appears to expect the output array to grow by at least 2 on each iteration, so if your result is an empty array after trimming leading and trailing zeroes you can create a new array of list.length + 2 and fill it with zeroes.

  • Custom User Avatar

    This kata very badly needs to be updated, there are no tests anymore and while the description asks for a "generator" it does not actually mean generator functions which now exist in JavaScript.

  • Custom User Avatar

    I'd like to add that this should in theory be using a linked list instead of an array, since it's having to re-index the array on every yield, which becomes a lot of work for large sequence sizes (like the pointless sequence test). Didn't time out here, so I guess array is acceptable :)

  • Custom User Avatar

    technically creates extra numbers, but I like how small this solution is without becoming an unreadable nightmare like 99% of the "best" solutions on here. Great work!

  • Custom User Avatar

    While trying to debug my solution I managed to find out that codewars allows for the injection of arbitary HTML via console.log. At least it removes script tags, so there's no immediatly obvious XSS vulnerability here. Still super annoying since it means I'll need to sanitize my own logs now.

    For reference here is the log function I used for debugging my solution:

    function ___log(text) {
      console.log(text.replace(/["'<>&]/gi, c => `&#${c.charCodeAt(0)};`));
    }
    
  • Loading more items...