Ad
  • Default User Avatar

    I don't know what that means. Have you read the description?

    arrange them such that they form the biggest number

    when you say "why", are you suggesting there's an order that forms a higher number? if so, what order is that?

  • Default User Avatar

    you're not asked to sort the numbers if that's what you mean. that seems to be what you're saying.

  • Custom User Avatar

    Also, your code fails for cases like

    [ [ -3, -9, 8, 7, -9, 7, 4, 7, 1 ],
      [Function: trueIfValueEqualsIndex] ]
    

    Because your founded will store 7, but you output the 1st occurence or index (position) of that value, in which the correct result should be 7 (index) instead of 3 (first occurence of the value 7)

  • Custom User Avatar

    If n is greater than the length of values, you should return the sum of the whole array. That's not what you are doing there :

    if(n > values.length){
            return values.length
          }
    
  • Custom User Avatar
                                        vv
    expected '65 119esi 111dl 111lw 108devi 105n 97n 111ka' 
    to equal '65 119esi 111dl 111lw 108dvei 105n 97n 111ka'
                                        ^^ 
    

    There

  • Default User Avatar

    I haven't yet unlocked this kata so I can't see test cases, but thinking logically:

    this example is using a function called trueIfLengthEqualsIndex - in other words it will return True if the element in the array has the same length as its index.

    Working through the example array given - write down the length of each element and its index:

    The input array ["one","two","three","four","five","six"]

    therefore gives - where e.g. len("three")=5 :

    [ index 0 len=3, index 1 len=3, index 2 len=5, index 3 len=4, >>>> index 4 len=4 <<<< , index 5 len=3]

    so I would expect 4 to be the correct result here.