Ad
  • Custom User Avatar

    In example tests function vodkaConsumption was calling twice on the same array.

    var example = ["40ml","5.5l"];
    
    Test.expect(vodkaConsumption(example) == "5540ml" || vodkaConsumption(example) == "6l");
    
    

    In your solution you have change array values to integer which doesnt have "indexOf" method.
    Im not an expert but arrays are pass into the function as reference so if you change passed array inside the function you affect that array outside that function.

    I have update test cases.It got me some time to figure it out.You can send your solution now.
    Cheers!

  • Custom User Avatar

    I figured it out, here's what I wrote:

    For everybody who gets 99999 instead of 99890, here is some help:

    THE INSTRUCTIONS ARE VAGUE. Here is an example, let's say they gave the number: 9834775899890938471234

    At first, I initially understood it as re-arranging all the numbers and finding the highest numbers within that.
    In this case it would be "99999".

    But it's actually asking for the highest SEQUENCE of 5-numbers in a row.
    In this case, it would be "99890".

    That is the difference, and I got it right. I hope this helps.

  • Custom User Avatar

    I understand your question and I have the same problem.

  • Custom User Avatar

    "99999" isn't included as substring in the input number (string), so your result is wrong. "99890" is included and it's the highest value of all 5 digit substrings, so it's the correct solution for this testcase (don't understand your question, but hope it helps;-))...