More Everyday Problems

Learn and practice with algorithms to deal with everyday problems.

Testing for certain conditions

There are three very handy algorithms called all_of(), any_of(), and none_of(). They all take a range, a unary predicate (a function that takes one argument and returns true or false), and an optional projection function.

Let’s say we have a list of numbers and a small lambda that determines whether a number is negative or not:

Get hands-on with 1200+ tech skills courses.