Skip to content

Category Archives: Competitive Programming

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
Given an undirected graph with V vertices and E edges, the task is to find all the connected components of the graph and check if… Read More
Given an array arr of distinct elements and a list of subsequences seqs of the array, the task is to check whether the given array… Read More
Given a string str with uppercase characters and an integer K, the task is to find the length of the longest subsequence such that the… Read More
Given an integer N, the task is to generate a string str which contains maximum possible lowercase alphabets with each of them appearing an odd… Read More
Given a number as a string where some of the digits are replaced by a ‘$’, the task is to generate all possible number by… Read More
Given an integer N, the task is to find the minimum cost to merge all the numbers from 1 to N where the cost of… Read More
Given a positive number N. The task is to find out the smallest perfect square number A such that N + A is also a… Read More
Given an array arr[], the task is to check if the minimum element in the array is less than or equal to half of every… Read More
Competitive Programming (CP) doesn’t typically require to know high-level calculus or some rocket science. But there are some concepts and tricks which are sufficient most… Read More
Given two strings str1 and str2 containing alpha-numeric characters and a number N. The task is to form a new encrypted string which contains the… Read More