Category Archives: Competitive Programming

Given two positive integers L and R, the task is to count the elements from the range [L, R] whose prime factors are only 2… Read More
Given a number N, the task is to find the sum of all the perfect square divisors of numbers from 1 to N. Examples:  Input: N… Read More
Given an array of positive integers, the task is to find the minimum number of insertions to be done in the array, to make the… Read More
Given an array arr[] of length N, the task is to check if it can be formed by merging two permutations of the same or… Read More
Given an integer N, the task is to find all distinct co-prime sets up to the given integer N such that an element doesn’t appear… Read More
Given an N*N binary matrix arr[][], the task is to check if the matrix contains a square of at least size 2 x 2 whose… Read More
Given an integer N print the sequence number of the given Triangular Number. If the number is not a triangular number then print -1. A… Read More
Given a string S and a matrix Q of queries, each specifying the starting and ending indices L( = Q[i][0]) and R( = Q[i][0]) respectively… Read More
Given a binary-valued Undirected Graph with V vertices and E edges, the task is to find the maximum decimal equivalent among all the connected components… Read More
Given a binary string S of length N, the task is to find the minimum number of bit flips required to convert the given string… Read More
Given an array arr[] consisting of integers of length N and an integer K (1 <= K <= N), the task is to find the… Read More
Given an array arr of distinct integers, the task is to find count of sub-arrays of size i having all elements from 1 to i,… Read More
Given a matrix board of characters and a string Word, the task is to check if Word exists on the board constructed from a sequence… Read More
Given a numeric string N and an integer K, the task is to split digits of N into subparts such that the number of segments… Read More
Given a numeric string S consisting of only three types of characters 0, 1, and 2 initially and following two operations:   The occurrence of two… Read More