3 ms·
C++ has std::reduce for that, which is std::accumulate except it's defined to operate without any specific ordering.
by mpyne 3mo ago
C++ has std::reduce for that, which is std::accumulate except it's defined to operate without any specific ordering.
- rzzzt 3mo agoThanks everyone, my C++ knowledge has been greatly expanded today.
- Joker_vD 3mo agoAnd now you should probably also stop and consider whether adding elements one-by-one as opposed to recursively adding together sums of smaller subarrays has better or worse numerical behaviour in regards to e.g. rounding and stability.