# Category Archives: C++

You are given an array on n-elements. An extrema is an elements which is either greater than its both of neighbors or less than its… Read More
Given an array, find the least frequent element in it. If there are multiple elements that appear least number of times, print any one of… Read More
Given a string str, the task is to perform the following type of queries on the given string:   (1, K): Left rotate the string by… Read More
Given an integer n, the task is to generate all the left shift numbers possible. A left shift number is a number that is generated… Read More
We have a sorted array with duplicate elements and we have to find the index of last duplicate element and print index of it and… Read More
Given a matrix of order m*n then the task is to find the frequency of even and odd numbers in the matrix Examples:  Input : m… Read More
Write code to find lexicographic minimum in a circular array, e.g. for the array BCABDADAB, the lexicographic minimum is ABBCABDADInput Constraint: 1 < n <… Read More
Given a string S containing lowercase English alphabets, and a matrix shift[][] consisting of pairs of the form{direction, amount}, where the direction can be 0… Read More
Given an array of n integers, find the third largest element. All the elements in the array are distinct integers. Example :   Input: arr[] = {1,… Read More
Given an array that is sorted and then rotated around an unknown point. Find if the array has a pair with a given sum ‘x’.… Read More
Given an array that is sorted and then rotated around an unknown point. Find if the array has a pair with a given sum ‘x’.… Read More
Given a linked list where every node represents a linked list and contains two pointers of its type:  Pointer to next node in the main… Read More
Given a singly linked list, write a function to swap elements pairwise. Input: 1->2->3->4->5->6->NULL Output: 2->1->4->3->6->5->NULL Input: 1->2->3->4->5->NULL Output: 2->1->4->3->5->NULL Input: 1->NULL Output: 1->NULL  For example, if the… Read More
Vector: Vector: It is the same as dynamic arrays with the ability to resize itself automatically when an element is inserted or deleted, with their… Read More
QuickSort on Doubly Linked List is discussed here. QuickSort on Singly linked list was given as an exercise. The important things about implementation are, it… Read More