C++

Check if Any element in Array Starts With a String in C++

This tutorial will discuss about unique ways to check if any element in array starts with string in C++. Table Of Contents Technique 1: Using std::find_if() function Technique 2: Using std::any_of() function Summary Technique 1: Using std::find_if() function Pass the start, and end iterators of array as first two arguments in STL Algorithm std::find_if(). Also,

Check if Any element in Array Starts With a String in C++ Read More »

Check if all elements of Array matches a Condition in C++

This tutorial will discuss about a unique way to check if all elements of an array matches a condition in C++. To check if all elements of an array matches a condition, we will use the std::all_of() function from STL Algorithms. An Intro about std::all_of() function: It accepts three arguments The std::all_of() function will apply

Check if all elements of Array matches a Condition in C++ Read More »

Check if all elements in array are unique in C++

This tutorial will discuss about unique ways to check if all elements in array are unique in C++. Table Of Contents Technique 1: Using std::unique() and std::distance() Technique 2: Using std::adjacent_find() Summary Technique 1: Using std::unique() and std::distance() To check if there are no duplicate elements in an array, first we will sort the array

Check if all elements in array are unique in C++ Read More »

Scroll to Top