Ad
  • Custom User Avatar

    I know this is old, but if you calculate the percentage as percentage = (sum/x)*100 (or whatever your language) it should always return the right percentage, though you'll need to use math.Floor() or whatever equivalent if you don't want the decimals to run off into space.

  • Custom User Avatar

    This took me some time to figure out, too. Basically a new Array is being defined with a given length, and it's an empty array. Then this empty array is being joined, with a given letter joining the empty indexes. For example, for i = 2, the Array has 3 empty indexes: [,,] and then it is joined by whatever letter is in letters[i]. Say letters[2] equals the letter a. Then if we join the empty array together with the letter in between each empty index, you get "aa".

  • Custom User Avatar

    Simplified

  • Custom User Avatar

    really, why don't you explain the example then. What's clear in your head, doesn't mean it's clear on others.

  • Custom User Avatar

    I disagree. The number of candles on the cake is given, and mentioned in the description:

    '''
    The numbers of candles on the cake is provided (x).
    '''

    '''
    You will work out the percentage of candles that will fall from the provided string (y).
    '''

    So if y is the amount of fallen candles, and the total number of candles (x) is given, you can get the percentage easily, several years of computer science or not.

  • Custom User Avatar

    nope, totally agreed with you. I am a several year computer science student and I can tell you that there are plenty of missing information. Trying to learn new language and test codewar, but there quite a few bugs on certain challenges. Good job at finding out the issue on this case.

  • Custom User Avatar

    I think it's unclear how to calculate the percentage of candles that will fall to the floor. In your example, the string y is 'abc' and has a value of 198. How do you calculate the percentage from 198? But then again I'm totally new, maybe I'm missing something?