Category "reduce"

Reduce javascript map change key dynamically

I would like to have the array in output using the input array in the reduce function. But I can't manage to dynamically add a key like this "${keyOrigin}": cur

Using reduce() to find min and max values?

I have this code for a class where I'm supposed to use the reduce() method to find the min and max values in an array. However, we are required to use only a si

How to group array or column based data by a specific item's/column's value while summing-up the values of another?

We are building an integration in a SAAS product which exports data from a table and writes it to a CSV file. Tool allows JavaScript (Which i am not very famili

How would you use .reduce() on arguments instead of a specific array or object?

I want to define a function .flatten that flattens several elements into one single array. I know that the following is not possible, but essentially I would li

Java Stream: divide into two lists by boolean predicate

I have a list of employees. They have isActive boolean field. I would like to divide employees into two lists: activeEmployees and formerEmployees. Is it possib

python: union keys from multiple dictionary?

I have 5 dictionaries and I want a union of their keys. alldict = [dict1, dict2, dict3, dict4, dict5] I tried allkey = reduce(lambda x, y: set(x.keys()).un