# Category Archives: Competitive Programming

Given two arrays A[] and B[], and an integer K, the task is to find the number of ways to select two subarrays of the… Read More
Prerequisites: MO’s algorithm, SQRT Decomposition Given an array arr[] of N elements and two integers A to B, the task is to answer Q queries… Read More
Given an array arr[] of integer elements, the task is to find the length of the largest sub-array of arr[] such that all the elements… Read More
Given an array arr[], the task is choose a subarray of size K which contains maximum number of valley points with respect to adjacent elements.… Read More
Given two arrays arr1[] and arr2[] and an integer K, our task is to find the number elements in the first array, for an element… Read More
Given an array arr[] of length N such that (1 <= arr[i] <= N), the task is to modify the array, by only inserting elements… Read More
Given a tree, and the weights of all the nodes, the task is to count the number of nodes whose weight is a Perfect number.… Read More
Given a sorted array arr[] of N integers and a number K, the task is to write the C program to find the upper_bound() and… Read More
Given an array arr[] of integer elements, the task is to find the length of the largest sub-array of arr[] such that all the elements… Read More
Given a Matrix of size N*N filled with 1‘s and 0‘s, the task is to find the maximum distance from a 0-cell to its nearest… Read More
Given a number N, the task is to find the sum of all N digits palindromic numbers (formed by digits from 1 to 9) that… Read More
This article focuses on how to implement your solutions and implement them fast while doing competitive programming. Setup Please refer Setting up a C++ Competitive… Read More
Given a Prufer sequence of a Tree, the task is to print the nodes with prime-degree in this tree. Examples: Input: arr[] = {4, 1,… Read More
Given two integers, X and K, the task is to find if X2 is divisible by K or not. Here, both K and X can… Read More
Given an array arr consisting of N elements and Q queries represented by L and R denoting a range, the task is to print the… Read More