# Category Archives: Competitive Programming

## Bitwise operations on Subarrays of size K

Given an array arr[] of positive integers and a number K, the task is to find the minimum and maximum values of Bitwise operation on… Read More »

## Competitive Programming vs Software Development – Where Should I Invest My Time?

Competitive Programming….what comes to your mind first…? most probably you associate the idea of solving the coding questions on GeeksforGeeks, Codechef, Topcoder, Codeforces, Hackerank, etc.… Read More »

## Queries to find the Minimum Weight from a Subtree of atmost D-distant Nodes from Node X

Given an N-ary Tree rooted at 1, and an array val[] consisting of weights assigned to every node, and a matrix Q[][], consisting of queries… Read More »

## Travelling Salesman Problem | Greedy Approach

Given a 2D matrix tsp[][], where each row has the array of distances from that indexed city to all the other cities and -1 denotes… Read More »

## Restore a shuffled Queue as per given Conditions

Given N people standing in a queue and two arrays A[] and B[]. The array A[] represent the name of the person and array B[]… Read More »

## Check if a String contains Anagrams of length K which does not contain the character X

Given a string S, the task is to check if S contains a pair of substrings of length K which are anagrams of each other… Read More »

## Minimize increment/decrement of Array elements to make each modulo K equal

Given an array arr[] of length N and an integer K. In each operation any element(say arr[i]) can be selected from the array and can… Read More »

## Remove all occurrences of a character in a string | Recursive approach

Given string str, the task is to write a recursive program to remove all the occurrences of a character X in the string. Examples: Input:… Read More »

## Check if Pascal’s Triangle is possible with a complete layer by using numbers upto N

Given a number N, the task is to determine if it is possible to make Pascal’s triangle with a complete layer by using total number… Read More »

## Test case generator for Tree using Disjoint-Set Union

In this article, we will generate test cases such that given set edges form a Tree. Below are the two conditions of the Tree: It… Read More »

## Find maximum of minimums from Layers of Matrix using numbers 1 to N^2

Given a square matrix of size N*N using numbers 1 to N^2, the task is to find the maximum of minimums of each layer of… Read More »

## How to setup Competitive Programming in Visual Studio Code for C++

GCC compiler installation We need to install GCC compilers for Windows. Linux has already GCC installed. Steps for installation 1.Download and Install the MinGW for… Read More »

## Minimum size binary string required such that probability of deleting two 1’s at random is 1/X

Given a value X, the task is to find a minimum size binary string, such that if any 2 characters are deleted at random, the… Read More »

## Count of N digit Numbers whose sum of every K consecutive digits is equal

Given two integers N and K, the task is to find the total count of N-digit number such that the sum of every K consecutive… Read More »

## Perfect Square factors of a Number

Given an integer N, the task is to find the number of factors of N which are perfect square.Examples:  Input: N = 100 Output: 4 Explanation: There are… Read More »