Ad
  • Custom User Avatar

    Approved by someone

  • Custom User Avatar

    ideally there should be some explanation in the initial code, yes. you can open a suggestion to request that.

  • Custom User Avatar

    Using enums is a great choice when they are supported.

    But on Codewars, you don't get the exact definition of the enum, so you need to guess how to use it.

    Is it really a good idea to go with that?

  • Custom User Avatar

    because it's better to use enumerated types in languages that support them. the reasons enums are rarely used on Codewars are 1) some translators are not aware of what is most idiomatic in their language of choice and 2) the first languages available on Codewars (JavaScript, Python, Ruby) do not have language support for enums¹, so they used string constants instead, and translators to other langauges replicated this interface most of the time.

    ¹: Python now has an enum module, but it's a library and not a language construct

  • Custom User Avatar

    Why choose to preload Color in Rust rather than use String, as is commonly done in other languages?

  • Custom User Avatar

    Isn't that explained in the Task part?

    The value of d can be "left" or "right". "left" means the "river" moves to the left. All elements in the 1D array are to the left moving n position, if beyond the bounds of the array and the element is moved to the tail on the left side of the array; if it exceeds the left boundary element would be moved to the tail of 3rd array(like a circle). Right is also similar to the operation, but it is moving to the right.

  • Custom User Avatar
  • Custom User Avatar

    It was supposed to be 9999. It is no longer included in the solution panel.

  • Custom User Avatar
  • Custom User Avatar

    Ah, thanks - had min and max switched around. Works now!

    By the way, I really like the idea of the "You are the author" katas. Hope to see more!

  • Custom User Avatar
  • Custom User Avatar

    Yeah, author's made a typo. I'll try to fix it but it's a bit of a mess.
    Anyway, here's the error you should be getting without the ReferenceError:

    ---10000 Random Test for correct solution---
    
    Result of first 50 random test:
    Test for: n= 1
    Test for....
    Your function generate number of multiple of 5 or 3: 80.38%
    
    ---Some Tests for randomly---
    
    Your random function looks seems not "randomly", let me test for it
    My wrong solution is:
    
    function ws(n){
      var a=[],
          b=[5],
          c=[3]
      return a.indexOf(n)>-1?"Fizz Buzz":b.indexOf(n)>-1?"Buzz":c.indexOf(n)>-1?"Fizz":n
    }
    
    The multiple numbers of your random function generate too few(less than 100):
    They are: [5,3]
    : expected false to deeply equal true
    

    PS: I didn't write all the Test for: n= <some number> but your solution seems to only return 1, 5 or 3.

  • Custom User Avatar

    Getting this error for JavaScript (Seems to be a bug in the test code; My function does not have an "x" variable):

    Your function generate number of multiple of 5 or 3: 80.34%
    
    ---Some Tests for randomly---
    
    Your random function looks seems not "randomly", let me test for it
    My wrong solution is:
     
    
    function ws(n){
      var a=[],
          b=[5],
          c=[3]
      return a.indexOf(n)>-1?"Fizz Buzz":b.indexOf(n)>-1?"Buzz":c.indexOf(n)>-1?"Fizz":n
    }
    
    ReferenceError: x is not defined
        at Context.<anonymous> (test.js:123:29)
        at process.processImmediate (node:internal/timers:471:21)
    
  • Custom User Avatar

    Это супер ката! Столько ловушек сколько их в этом ката я не видел нигде! Я решил эту ката, но мне это стоило 3х бессонных ночей. Но даже после того как мое решение прошло все тесты и было принято, у меня остался вопрос. Почему когда я считаю удары часов в интервале до и после полуночи, я ввожу 2 переменные и присваиваю первой переменной значение количества ударов до полуночи, а второй переменной присваиваю значение количества ударов после полуночи, и потом суммирую значения этих переменных. А если не разделять количество ударов до полуночи и после полуночи,то один удар где-то теряется и результат выходит неверный. Почему так получается , я так и не понял. Если кто-то знает ответ - объясните мне, пожалуйста!!!!!

  • Custom User Avatar
  • Loading more items...