6 kyu

Difference of perfect squares displayed as sum of consecutive odd numbers

218 of 402Cloud Walker
Description
Loading description...
Algorithms
Mathematics
  • Please sign in or sign up to leave a comment.
  • timleungtech Avatar

    This comment has been hidden.

  • Arkadiusz Kłeczek Avatar

    Nice kata was fun after understanding what was i supposed to do :D

  • mauro-1 Avatar
  • Liamzy Avatar

    This needs to be more specific.

    For instance:

    given 10, 0 Log 50 expected undefined to deeply equal '10^2 - 0^2 = 1 + 3 + 5 + 7 + 9 + 11 + 13 + 15 + 17 + 19 = 100'

    100 can be interpreted as 49 + 51 or the given answer.

    • Cloud Walker Avatar

      Specific-ations. At the very top, The "Specifications" bulleted list states that the "first input minus the second input...". Please read more carefully.

      Issue marked resolved by Cloud Walker 3 years ago
    • Liamzy Avatar

      The title's misleading; i.e, it's less about figuring out a mathematical problem and more about implementing an algorithm.

  • natashapettinger Avatar

    In the examples, why does 27 + 29 not work for the first example? How do you decide how many odd numbers you need to return? And why doesn't 51 just return 51? Since it's odd?

    • natashapettinger Avatar

      I maybe understand with the asterisked sentence in the notes... but that needs to be further up. Super confusing.

    • Cloud Walker Avatar

      In the Description at the bottom, after the asterisk it states: The first input minus the second input reveals the number of consecutive odd numbers required for the solution. (otherwise all of the odd solutions would deteriorate into one odd number)Also consider this kata is categorized as a puzzle and requires a bit of deduction from the user. Maybe I should edit and bring the info after the asterisk to the top? Buried down there, probably easy to miss.

    • dfhwze Avatar

      Yes, put the "notes" above the "examples" and perhaps in a bulleted list. And perhaps also call those notes "the specification" instead.

    • Cloud Walker Avatar

      Okay. Might take me an hour or two. Operating from my phone and not enough sleep.

    • Cloud Walker Avatar

      Okay. revised with the bulleted list. Looks like a good improvement.

    • natashapettinger Avatar

      I wasn't expecting any reply! Thanks very much. I think this is a good improvement.

    • Cloud Walker Avatar

      Sure thing. It made for a better looking, more concise description. Thank you. Would have replied sooner but im on my phone todsy and its difficult to edit and text here on codewars. Cursor is hyper and jumps around.

  • RealKenshiro Avatar

    Consider adding the math tag.

  • Cloud Walker Avatar

    I have made all necessary edits but still see that my kata says it has issues. Did I miss something?

  • dfhwze Avatar

    Random test case should show the input in the title of the test case instead of random test case. I suggest you use the same format as your fixed tests given ${sqr1}, ${sqr2}.

    • Cloud Walker Avatar

      That works great.Thanks. So each time i edit i will need to re-publish? How can i get back to the Editing blocks for this particular kata? im working in a separate browser so i dont lose the edit page for this kata. Saved the address and that works so far, but each time i leave or and try to come back it asks if i want to "keep" the data i have so far. Just worried ill lose the whole kata and time invested. The save button is gone and i only see republish or unpublish.

    • Captain Quack Avatar
      • The re-publish button does the same thing as the save button (except for now your changes are beign published)

      • Publishing auto-saves it, so you won't lose the kata.

    • benjaminzwhite Avatar

      Trying to summarise the various steps/states of the editor here:

      • if the kata is already published (this means: either in Beta, or fully approved), then yes each time you make an edit in your editor, you will need to click Re-publish button - this saves the edits and makes them available to the users who access your kata.

      • If you Unpublish, then the Beta goes back to Draft mode: the main reason for doing this is to "hide" your kata from downvotes if it has lots of issues. Basically, if you publish to Beta and nothing works correctly, description is bad, it's a duplicate etc etc then you will probably find that your kata gets downvoted, which in turn will make it almost impossible to reach the satisfaction % to get approval. Therefore, if you get a friendly reviewer who suggests Unpublish in order to make major changes to the kata, it can be a good idea to Unpublish and keep working on it. On the other hand, if it's just a typo or you're missing 1-2 test cases, then you can just "edit + Republish" as described above.

      • the thing about "keep" message appearing is (AFAIK) a bug; someone who has been on CW for longer than me can confirm, but basically if you just always click keep it seems to behave OK. I still keep local copies of all my katas though, so I can repaste them if I ever deleted by accident in the CW editor.

    • Cloud Walker Avatar

      Appreciate the explanation. Very enlightening. One question though..if you need to edit your kata, how do you get back to the editing page for that particular kata? I mean, where on codewars site are the links to get back to a kata that needs editing?

    • dfhwze Avatar

      you must resolve an issue, or wait for the issuer to resolve it for you

      Issue marked resolved by dfhwze 3 years ago
  • Cloud Walker Avatar

    Thank you,everyone.Voile. Just republished after adding the code. About to test it.

  • rowcased Avatar
    ReferenceError: assert is not defined
        at Context.<anonymous> (test.js:9:5)
        at processImmediate (internal/timers.js:464:21)