+ 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

25th Mar 2018, 7:16 PM
Tomer Sim
9 ответов
+ 14
https://code.sololearn.com/cthTsjEsWo9o/?ref=app
25th Mar 2018, 10:29 PM
LukArToDo
26th Mar 2018, 9:45 AM
Gaurav Agrawal
+ 8
@Tomer Sim Thank you for your mark 😊 You made me to think in a new way to solve this task. Thanks 😉
26th Mar 2018, 11:24 AM
LukArToDo
+ 4
Louis, what you did is incorrect. you've iterated through the loop for more then one time. i asked for one time.
25th Mar 2018, 9:23 PM
Tomer Sim
25th Mar 2018, 8:35 PM
Louis
+ 3
@~ swim ~ But they do? Mine works just fine.
28th Mar 2018, 8:37 AM
Tomer Sim
+ 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 :)
28th Mar 2018, 3:58 PM
Tomer Sim
0
Implemented as a class extension recursion in Python. https://code.sololearn.com/c2uGK2DfblHd/?ref=app
26th Mar 2018, 3:19 PM
Edward
0
And I'm not sure if a statement like "if n in myList" should not also be considered an iteration...
27th Mar 2018, 8:52 AM
Edward
Актуальное сегодня
Html code