Category: programming languages
Novice C++ programmers usually write a simple for loop if they want to count number of particular elements in the array – which could be entirely replaced by STL::count …
The Reduce in terms of Map-Reduce is often referring to reducing many values (vector) to a single value (scalar). In C++, the STL has a accumulate() method that allows …
Nowadays, you don’t have to implement your sorting algorithms e.g. quicksort, selection sort, insertion sort etc by yourself. Most programming languages provide the functions/library to do the sorting efficiently, …
Let’s say we want to implement a C++ function based on STL containers to check if a given string contains duplicate characters, or a given vector/array contains duplicate elements. …
A sequence X_1, X_2, …, X_n is fibonacci-like if: n >= 3 X_i + X_{i+1} = X_{i+2} for all i + 2 <= n Given a strictly increasing array …