Ad
  • Custom User Avatar

    I agree with OP. The attempt should be false on this exact example, because $a1[2] squared is not $a2[3]. This is the exact comparison that comes up in my code in the false case, yet the test for this set of arrays is expecting true. 19 * 19 (361) does not equal 36100.

  • Custom User Avatar

    For everyone struggline with the test-cases, especially the "fixed cases" when attempting the full solution:
    If everything but one (or more) test fails - put in some proper debugging, also for your positive cases!

    I stumbled across my own feet when trying to debug one case which the output of "False should equal True" was not even meant to be attached to. When implementing proper debugging for each and every case I spotted my mistake and could easily fix my issue just one minute after it. Though being 3 kyu, I spent a lot more time debugging this than I wanted to. This should teach me a lesson, I guess :D

  • Custom User Avatar
  • Default User Avatar
  • Custom User Avatar
  • Custom User Avatar

    Which part don't you understand? The mathematical or the progamming part? On either part you can work. ;)

    If I were you I wouldn't let myself down or doubt myself because I don't instantly get the solution done. It always takes some time to understand the problem, work on a solution and then implement it. Sometimes you are stuck, sometimes you get frustrated. But that's normal. I'm stuck on some Katas as well.

    Here's my solution:

    First of all - don't give up!
    Second, try to find out how you can calculate the average of a list of numbers.
    Third, head over to your IDE and try to understand how to iterate through values and calculate their average.
    If you don't have an answer for something - try googling. That's what you will spend the most time when programming :D

    I'm pretty sure you'll get this one done. ;)

  • Custom User Avatar

    Not a kata issue if your PC works differently.

  • Custom User Avatar

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

  • Custom User Avatar

    Gotta admit that I was thinking way too complicated but I really enjoyed this Kata so damn much! Cheers mate for this splendid piece of work! :>

  • Custom User Avatar

    First line:

    returns an array of the top-3 most occurring words, in descending order of the number of occurrences.

    Incorrect frequencies: 21, 24, 28 should be 28, 27, 24

    Now you know why it fails. Also, you missed some word with 27 occurrences there, have you tried printing the input?

  • Custom User Avatar

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

  • Default User Avatar

    Well, your message is quite vage about why you fail or which error message it displays. Mine failed because of the wrong usage of variables which differs from this environment to your local one.

  • Default User Avatar

    lol, my horrible solution passes the Kata? No checking for primes?
    (Note: I've forked this Kata to add Prime-checking)

  • Default User Avatar

    Same here, I giggled very loudly as I saw the solution of others. I actually did not spend a whole lot of time writing the code because I have already had a solution at this Kata = https://www.codewars.com/kata/5d5a7525207a674b71aa25b5
    Only added two more lines to this solution and fell off my chair as I saw how stupid and simple the solution was to this one :D

    So, see you at night shift at the factory, I guess :D

  • Default User Avatar

    I know this looks ugly, but it works. I'll refactor soon, but I am still learning. :D

  • Loading more items...