Maximum of XOR of first and second maximum of all subarrays
Given an array arr[] of distinct elements, the task is to find the maximum of XOR value of the first and second maximum elements of every possible subarray.Note: Length of the Array is greater than 1. Examples:...
read more
How to Copy a List in C++ STL?
In C++, a list is a sequence container provided by the STL library that represents a doubly linked list and allows us to store data in non-contiguous memory locations efficiently. In this article, we will learn how to copy one list to another in C++....
read more
How to Release Memory in C++?
In C++, releasing memory means deallocating the memory that was previously allocated by the user. It is very important to avoid memory leaks. Other programming languages like Java support automatic garbage collection to release the dynamically allocated memory, but in C++ we have to release the allocated memory manually. In this article, we will learn how to release memory in C++....
read more
How to Implement a Copy Constructor for Deep Copying?
In C++, the copy constructor enables us to initialize an object using another object of the same class. In this article, we will learn, how to implement a copy constructor for deep copying....
read more
How to Declare a Vector in C++?
In C++, the vector is a dynamic array that can resize itself automatically to accommodate new elements. In this article, we will learn how to declare a vector in C++....
read more
How to Find the Cumulative Sum of Array in C++?
In C++, the cumulative sum, also known as the prefix sum of an array is the sum of all elements of the array at the current index including the sum of the previous elements. In this article, we will learn how to find the prefix sum of elements in an array in C++....
read more
How to Check if a Set is Empty in C++?
In C++, a set is an associative container that stores unique elements in a sorted order. In this article, we’ll explore different approaches to check if a set is empty in C++ STL....
read more
C++ Program to Count rotations in sorted and rotated linked list
Given a linked list of n nodes which is first sorted, then rotated by k elements. Find the value of k....
read more
C++ Program to Modify given array to a non-decreasing array by rotation
Given an array arr[] of size N (consisting of duplicates), the task is to check if the given array can be converted to a non-decreasing array by rotating it. If it’s not possible to do so, then print “No“. Otherwise, print “Yes“....
read more
C++ Program For Merging Two Sorted Linked Lists Such That Merged List Is In Reverse Order
Given two linked lists sorted in increasing order. Merge them such a way that the result list is in decreasing order (reverse order)....
read more
std::is_trivially_assignable in C++ with Examples
The std::is_trivially_assignable template of C++ STL is present in the <type_traits> header file. The std::is_trivally_assignable template of C++ STL is used to check whether a value of type B can be assigned to type A or not. It returns the boolean value either true or false....
read more
std::is_nothrow_assignable in C++ with Examples
The std::is_nothrow_assignable template of C++ STL is present in the <type_traits> header file. The std::is_nothrow_assignable template of C++ STL is used to check whether A is type assignable to B or not and this is known for not to throw any exception. It return the boolean value true if A is type assignable to B, Otherwise return false....
read more