Ad
  • Default User Avatar

    But the kata itself shows numbers being returned by themselves and even states the function should return a number at one point. Not an object that is coerced to be equal to a number. It can really lead people astray when the description lies to us.

  • Default User Avatar

    Could have clarified that numbers being the same counts as ascending order, also in the submitting portion it was saying

    Expected: false, instead got: true when my code was submitting false and the answer expected was true. Would have been able to figure out what you actually wanted a lot faster if this was corrected.

  • Default User Avatar

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

  • Default User Avatar

    Yours works because you returned nil if you had falsy input so when it was tested w/ the nil case the input of nil was evaluated as false so !input was true so it returned nil. It's the same idea and will also work if they pass in false I guess just slightly less clear what is being tested.

  • Default User Avatar

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

  • Default User Avatar

    Any hint or advice for dealing w/ the 20th test of the biggest integer? I don't believe we can use any libraries here to deal w/ large numbers? I saw one blog post say something about strings but I don't know how you could add to something when it's a string which we sitll need to do here.

    The original code was fairly simple to set up but I am still quite new to programming.

  • Default User Avatar

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

  • Default User Avatar

    Class passes timed test
    40,000 get functions completed in 328ms. Shoot for less than 15ms.
    Your get functions should take O(1) time! Are you storing all the temperatures?

    boo urns

    I'm doing this in javascript and only started teaching myself programming ~3 weeks ago so I don't know what 0(1) time means. I am sort of storing the temps? I have created an object that lists every temperature that has occurred as a property and increase the count of that property by 1 for each time the temperature occurs. If that temperature hasn't occurred it will create a new property w/ that temperature name. Is this method too inefficient for the time requirement? I can't imagine a very different method to get a reliable mode happening other than possibly something similar w/ an array but I am quite new as I said.

    Class passes timed test
    40,000 get functions completed in 108ms. Shoot for less than 15ms.
    Your get functions should take O(1) time! Are you storing all the temperatures?

    realized my min and max were done really stupidly. also looked up what O(1) means so that happened. Still don't know how you'd do mode like that though

    EDIT: nvm guys I figured out a way. I also didn't realize the stress test was ONLY testing on the get functions and not putting it all together.

  • Default User Avatar

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