# Category Archives: Competitive Programming (adsbygoogle = window.adsbygoogle || []).push({});

## Find two numbers whose divisors are given in a random order

Given an array of N numbers which has all divisors of two numbers in any order. The task is to find the two numbers whose… Read More »

## Maximum subarray sum in array formed by repeating the given array k times

Given an integer k and an integer array arr[] of n elements, the task is to find the largest sub-array sum in the modified array… Read More »

## Minimum replacements such that the difference between the index of the same characters is divisible by 3

Given a string of ‘0’, ‘1’ and ‘2’. The task is to find the minimum replacements in the string such that the differences between the… Read More »

## Minimum replacements to make adjacent characters unequal in a ternary string

Given a string of ‘0’, ‘1’ and ‘2’. The task is to find the minimum number of replacements such that the adjacent characters are not… Read More »

## Program to find LCM of two Fibonnaci Numbers

Given here are two positive numbers a and b. The task is to print the least common multiple of a’th and b’th Fibonacci Numbers. The… Read More »

## Make Binary Search Tree

Given an array arr[] of size N. The task is to find whether it is possible to make Binary Search Tree with the given array… Read More »

## Check whether XOR of all numbers in a given range is even or odd

Given a range [ L, R ], the task is to find if value of XOR of all natural numbers in range L to R… Read More »

## Geometric Median

In normal median, we find a point that has minimum sum of distances. Similar concept applies in 2-D space. Given N points in 2-D space,… Read More »

## Color N boxes using M colors such that K boxes have different color from the box on its left

Given N number of boxes arranged in a row and M number of colors. The task is to find the number of ways to paint… Read More »

## Remove characters from a numeric string such that string becomes divisible by 8

Given a non-negative integer represented in the form of a numeric string str. Remove zero or more characters from the string such that the number… Read More »

## Divide N segments into two non-empty groups such that given condition is satisfied

Given N segments (or ranges) represented by two non-negative integers L and R. Divide these segments into two non-empty groups such that there are no… Read More »

## Check if it is possible to reach a number by making jumps of two given length

Given a starting position ‘k’ and two jump sizes ‘d1’ and ‘d2’, our task is to find the minimum number of jumps needed to reach… Read More »

## Find array using different XORs of elements in groups of size 4

Given an array q[] of XOR queries of size N (N is a multiple of 4) which describe an array of the same size as… Read More »

## Rectangle with minimum possible difference between the length and the width

Given an integer area, the task is to find the length and breadth of a rectangle with the given area such that the difference between… Read More »

## Some useful C++ tricks for beginners in Competitive Programming

Here are some of the basic C++ tricks that every beginner in Competitive Programming should follow for increased speed. However, competitive programming can only be… Read More »