osdir.com


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Design a function that finds all positive numbers


A numeric array of length 'N' is given. you need to design a function that finds all positive numbers in the array that have their opposites in it swell. give the approach for solving the optimal average or best case performance. answer will be your obsolute.
Array: -7,4,-3, 2, 2, -8, -2, 3, 3, 7, -2, 3, -2
sorted: -2, -2, -2 ,2 ,2, -3, 3, 3, 4, -7, 7, -8?

can I solve any problems like this by learning python? if anybody knows this answer or any mistakes in this question, please explain to me in detail? I wanna practice more problems like this thank you.