3 ms·
I'm not sure I understand the problem. If we only need to determine what set produces a sum of square roots that is larger, why can't we simply compare the sum
by breezeTrowel 5y ago
I'm not sure I understand the problem. If we only need to determine what set produces a sum of square roots that is larger, why can't we simply compare the sum of the original numbers? The square root of 2.0000001, for example, is larger than the square root of 2. The square root of X will be always be larger than the square root of Y if X is larger than Y.
The real problem is calculating the precision of square roots. But the challenge stated in the post can be solved rather easily in a programmatic fashion by simply comparing initial inputs.
- ianthehenry 5y agoConsider [25] and [9, 9]. 25 > 18, but 5 < 6.
- x3n0ph3n3 5y agoThanks! I had the same thought as the OP and this is just the counter-example I needed.
- deleted 5y ago[deleted]
- deleted 5y ago[deleted]
- soperj 5y agoyou're adding the two square roots though. so for example, which is bigger: [2.00000000000000011,2.0000000000000003],[2.0000000000000002,2.00000000000000021]
- umvi 5y agof(x) = sqrt(x) does not increase linearly with x so you can't do that. Compare the plotted graphs of x (input) vs. sqrt(x) (output)