We have one 2D array, filled with zeros and ones. We have to find the starting point and ending point of all rectangles filled with 0. It is given that rectangles are separated and do not touch each other however they can touch the boundary of the array.A rectangle might contain only one element....
Given a NxM matrix of integers containing duplicate elements. The task is to find the sum of all minimum occurring elements in the given matrix. That is the sum of all such elements whose frequency is even in the matrix....
Given an array arr[] of size N, the task is for each array element is to find the nearest non-equal value present on its left in the array. If no such element is found, then print -1...
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:...
Given an array of integers, find the smallest number after deleting given elements. In case of repeating elements, we delete one instance (from the original array) for every instance present in the array containing elements to be deleted....
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++....
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++....
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....
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++....
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++....
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....
Given a linked list of n nodes which is first sorted, then rotated by k elements. Find the value of k....