+ 9
[Challenge] Array's and numbers
Create a function which accepts a sorted array(by size) which is type double. and a number. Then the function will check if any sum of 2 numbers from the array can create the number accepted by the function. if the duo exists the function will return True, otherwise it'll return false. And one last thing, only one iteration is allowed :) Any language is allowed. GL & HF My solution in python : https://code.sololearn.com/ciqsxjrZQovv/#py
14 Answers
+ 14
https://code.sololearn.com/cthTsjEsWo9o/?ref=app
+ 19
//no loop , only recursion
https://code.sololearn.com/cbWQtm7Zh8pR/?ref=app
+ 8
@Tomer Sim
Thank you for your mark š
You made me to think in a new way to solve this task. Thanks š
+ 4
Louis, what you did is incorrect. you've iterated through the loop for more then one time.
i asked for one time.
+ 3
@~ swim ~ But they do? Mine works just fine.
+ 3
well pal.
if you didn't notice. 18.4+12.7 is not 31.1, it'll be 31.099999999 and you're invited to test it. i
Thanks :)
0
Implemented as a class extension recursion in Python.
https://code.sololearn.com/c2uGK2DfblHd/?ref=app
0
And I'm not sure if a statement like "if n in myList" should not also be considered an iteration...