Coding challenge

Create a function named ArrayChallenge (Javascript) or array_challenge (ruby) which accepts a single argument “arr” which is an array of numbers. This function will return the string true if any two numbers can be multiplied so that the answer is greater than double the sum of all the elements in the array. If not, return the string false.

For example: if the argument “arr” is [2, 5, 6, -6, 16, 2, 3, 6, 5, 3] then the sum of all these elements is 42, and doubling it is 84. There are two elements in “arr”, 16 * 6 = 96 where 96 is greater than 84, so your program should return the string true. An example of an “arr” which should return false is [1, 2, 4] since double its sum (14) is larger than multiplying its two largest elements (4 * 2 = 8).

I’m not sure what you are asking here.

Are you asking us to do this for you? We don’t really do that here - we are a learning platform so we’d rather have you try and share what you’ve tried to get some hints.

Are you suggesting this as a challenge for us to try? We don’t really do that much here, and ruby isn’t one of the languages FCC teaches.

The fact that you specify the languages makes me think that it’s a former.

1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.