Design a function that finds all positive numbers
Ranjith Bantu <ranjithbantu at gmail.com> writes:
> 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?
You need to learn how to solve problems as well as learning Python --
they go hand in hand -- but Python is a good language to get started
> if anybody
> knows this answer or any mistakes in this question, please explain to
> me in detail?
That would require quite a long essay! As to the question, it's a bit
odd to talk of opposites, but it's not ambiguous. More problematic is
what to do with duplicates. The question should be worded so that it's
either clear what is wanted, or so that it is clear that you should
decide what to do.