The standard library provides a lot of useful algorithms in the <algorithm> header. The STL algorithms work with most containers like std::vector, std::array, and std::map.
The algorithms can be used with variety of containers since they utilize iterators. They work on the containers within the range [first, last), most commonly using the begin() and the end() methods on the container to get the first and last iterators.
To save time, use the built-in algorithms instead of writing your own implementation.
Task
Read the code. Run the program and see the output.