Skip to content

Category Archives: C++

Given a linked list of 0s, 1s and 2s, sort it.Examples: Input: 1 -> 1 -> 2 -> 0 -> 2 -> 0 -> 1… Read More
Question: Write a function to find if a given integer x appears more than n/2 times in a sorted array of n integers. Basically, we need… Read More
Given a square matrix of order n*n, find the maximum and minimum from the matrix given.  Examples:  Input : arr[][] = {5, 4, 9, 2,… Read More
Given a binary array sorted in non-increasing order, count the number of 1’s in it.  Examples:  Input: arr[] = {1, 1, 0, 0, 0, 0,… Read More
Given two positive integers x and y, check if one integer is obtained by rotating bits of other.  Input constraint: 0 < x, y <… Read More
An array in C/C++ or be it in any programming language is a collection of similar data items stored at contiguous memory locations and elements… Read More
This article focuses on function/method overloads by references, as well as the types of arguments that can be passed. Prerequisites: l-value references. r-value references. Move… Read More
Maps are associative containers that store elements in a mapped fashion. Each element has a key value and a mapped value. No two mapped values… Read More
Sets Sets are a type of associative container in which each element has to be unique because the value of the element identifies it. The… Read More
Priority Queues Priority queues are a type of container adapters, specifically designed such that the first element of the queue is the greatest of all… Read More
Lists Lists are sequence containers that allow non-contiguous memory allocation. As compared to vector, the list has slow traversal, but once a position has been… Read More
Priority Queue Priority queues are a type of container adapters, specifically designed such that the first element of the queue is the greatest of all… Read More
Write a function rotate(arr[], d, n) that rotates arr[] of size n by d elements. Example :  Input : arr[] = [1, 2, 3, 4, 5,… Read More
Given an array of distinct integers and a sum value. Find count of triplets with sum smaller than given sum value. The expected Time Complexity… Read More
There are two singly linked lists in a system. By some programming error, the end node of one of the linked lists got linked to… Read More

Start Your Coding Journey Now!