Skip to content

Category Archives: Competitive Programming

Given an array arr[], the task is to arrange the array in such a way that the absolute difference between the adjacent elements is in… Read More
Given a matrix of size N x M consisting of integers 1, 2, 3 and 4. Each value represents the possible movement from that cell:  1… Read More
Given an array arr[] of some positive integers and missing occurrence of a specific integer represented by -1, the task is to find that missing… Read More
Given two numbers, N and M, the task is to find two numbers made up of M as all its digits such that their difference… Read More
Given an array arr[], the task is to count the number of times the minimum and the maximum value is updated during the traversal of… Read More
Given two integers N and K, the task is to find K numbers(A1, A2, …, AK) such that ∑i=1KAi is equal to N and ∑i=1KAi2… Read More
Given an array arr[] of N integers and an integer K, our task is to find the length of the longest subarray such that for… Read More
Given an array arr[] and an integer K, the task is to find the number of merge operation required such that all the elements of… Read More
Given a number N. The task is to group all the numbers from 1 to N such GCD of all the numbers in each group… Read More
Given string str, the task is to find the longest palindromic substring formed by the concatenation of the prefix and suffix of the given string… Read More
Given a number N, the task is to find the sum of all N-digit palindromic numbers which are divisible by 9 and the number doesn’t… Read More
Given a directed graph with N nodes and E edges, a source S and a destination D nodes. The task is to find the path… Read More
Given an integer array arr[] of size N and an integer X, the task is to find the longest sub-array where the absolute difference between… Read More
Given a binary number in the form of a string, the task is to print a binary equivalent obtained by flipping only one contiguous set… Read More
Given an integer N, the task is to create two sets of distinct elements from 1 to N such that the gcd of their respective… Read More