Given an integer N, the task is to count the number of ways so that N can be written as the sum of a prime… Read More

# Category Archives: Competitive Programming

Given a tree of N nodes, the task is to convert the given tree to its Sum Tree(including its own weight) and find the minimum… Read More

Given four integers A, B, C, and D, the task is to find the number of distinct sets (X, Y, and Z) where X, Y… Read More

Given an array A of non-zero integers, the task is to find the number of pairs (l, r) where (l <= r) such that A[l]*A[l+1]*A[l+2]….A[r]… Read More

Given a range in the form of L and R, and a value K, the task is to count the numbers between the range L… Read More

Given an array arr[] of N elements, the task is to answer Q queries each having two integers L and R. For each query, the… Read More

Given a binary tree having N nodes and weight of N-1 edges. The distance between two nodes is the sum of the weight of edges… Read More

Given an array A[] of integers and array Q consisting of queries of the following two types: (1, L, R) : Return XOR of all… Read More

Given a N-ary Tree and Q queries where each query contains a node of the N-ary tree, the task is to count the number of… Read More

Given an N-ary tree with weighted edge and Q queries where each query contains two nodes of the tree. The task is to find the… Read More

Given a numeric string target of length N and a set of numeric strings blocked, each of length N, the task is to find the… Read More

Given a binary string S, the task is to partition the sequence into K non-empty subsets such that the sum of products of occurences of… Read More

Given three integers P, Q, and R, the task is to generate a binary string with P, Q, and R pairs of consecutive characters with… Read More

Given an array arr of N elements and another array Q containing values of K, the task is to print the count of elements in… Read More