Ad
  • Custom User Avatar

    Some 1-liners are difficult to figure out what it's doing. This one is pretty easy to read.

  • Custom User Avatar

    I also chose sorting, but I'd like to run some time comparisons on these different methods.
    I'm pretty sure that memory swaps cost more time than comparisons.

  • Custom User Avatar

    I did sorting just like you. I need to learn when you can make an if else be on a single line.
    I would like to compare the run speeds of this versus some of the other methods. Sorting should
    be fast with most of them the same, no swaps should need to happen.

  • Custom User Avatar

    This has to do with floating point rounding errors. The formula can be rearranged a little bit so that the rounding errors have less impact, I believe.

  • Custom User Avatar

    If you have 1 red marbles and 99 green marbles in a box that is your 99 percent.
    Now think about having the same 1 red marble and a quantity of green marbles such that
    there are 98 percent green and 2 percent red. See if you can work out a formula for that.

  • Custom User Avatar

    Are you saying that the tests fail? What do you mean result 0?
    I was having issues with most of them passing, and some failing.

    Then I remembered about how computers store floating point and you can get
    little rounding errors. Look at your formula and see if you can simplify it some.

  • Custom User Avatar

    Nice. I feel like I learn more by trying a certain way, then reading how others do it, and I'm like "wow cool!"

  • Custom User Avatar

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

  • Custom User Avatar

    I think the first one I picked (count the vowels) was more difficult than this one. I'm not sure what level that one was. Of course, after I solved it, I saw several clever 1-Liners.