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

# Category Archives: Competitive Programming

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 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 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 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