The points people are trying to drive home are:
|
Quote:
|
Off: now I think my idea to make elements positive by adding a constant value was wrong... So right now I think we have to calculate the n(n-1)/2 interval-sums, then perform a sort to find the duplications.
|
I find the exercise a little conceptually odd, and I don't fully get this concept of "pairs" rather than just reporting the number of duplicate results, but my first run using the input from the example gives the same results as described in OPs description, so I assume I've understood the goal correctly.
Code:
$ time -p (echo "1 5 2 4 2 2 2" | ./sum_range ) Code:
$ time -p ( seq 1 100| ./sum_range | grep Total ) |
Quote:
|
Quote:
|
Yeah, but how many of those are ducks? :)
Anyway, not clear on the current status of the thread... do you still have an outstanding memory leak, or a different issue, or is it solved now? |
All times are GMT -5. The time now is 11:48 PM. |