Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
The first call to Lambda Function by std::accumulate uses the initial value 0 as 'a' and the first element of the vector as 'b'.
for these ex : std::vector{-1, 2, 3, 4, -5};
first imple : a = 0, b = -1 ==> resul a + std::max(0, b) = 0 + 0 = 0; then store the result to a.
Second imple : a = 0, b = 2 ==> resul a + std::max(0, b) = 0 + 2 = 2; then store the result to a.
.....
The STL has built-in stuff for a reason. This is exactly what this function is used for.
whats part you didnt get it ?
I can't understand this solution
I can't understand this solution
This comment is hidden because it contains spoiler information about the solution
yeah, but at some point parallel
execution_police
becomes benefitialP.S. we would have to replace
accumulate
withreduce
max(0, b) is very clever!
this approach is interessant from STL perspective but less performant than iterating through the vector with for() loop
or kill a mosquito using a cannon.
I was wondering what the point of the higher order function was, but clearly it turned 4 lines of repeated code into 1. Had to change my solution to this one!
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
description update is required before this can be approved. Change description to match.
This comment is hidden because it contains spoiler information about the solution
Loading more items...