# Category Archives: Competitive Programming

## Maximize the number of subarrays with XOR as zero

Given an array of N numbers. The task is to maximize the number of subarrays with XOR value zero by swapping the bits of array… Read More »

## Longest Subsequence with at least one common digit in every element

Given an array. The task is to find the length of the longest subsequence in which all elements must have at least one digit in… Read More »

## Check whether it is possible to join two points given on circle such that distance between them is k

Given two circles and a length K. Find whether we can join two points (one on perimeter of each circle), so that distance between the… Read More »

## Largest number with the given set of N digits that is divisible by 2, 3 and 5

Given a set of ‘N’ digits. The task is to find the maximum integer that we can make from these digits. The resultant number must… Read More »

## Generate a number such that the frequency of each digit is digit times the frequency in given number

Given a number N containing digits from 1 to 9 only. The task is to generate a new number using the number N such that… Read More »

## Check whether the given number is Euclid Number or not

Given a positive integer n, the task is to check if it is Euclid Number or not. Print ‘YES’ if the given number is Euclid… Read More »

## Check whether the given number is Wagstaff prime or not

Given a positive integer n, the task is to check if it is a Wagstaff prime or not. Print ‘YES’ if the given number is… Read More »

## Minimum number of digits to be removed so that no two consecutive digits are same

Given a number N. The task is to count the minimum number of digits to be removed from the number so that no two consecutive… Read More »

## Find the number of rectangles of size 2*1 which can be placed inside a rectangle of size n*m

Given two integers , . Find the number of rectangles of size 2*1 can be placed inside a rectangle of size n*m. Note: No two… Read More »

## Number of solutions for the equation x + y + z <= n

Given four numbers x, y, z, n. The task is to find the number of solutions for the equation x + y + z <=… Read More »

## Program to find the angles of a quadrilateral

Given that all the angles of a quadrilateral are in AP having common difference ‘d’, the task is to find all the angles. Examples: Input:… Read More »

## Sum of the first N Prime numbers

Given an integer ‘n’, the task is to find the sum of first ‘n’ prime numbers. First few prime numbers are: 2, 3, 5, 7,… Read More »

## Check if a cell can be visited more than once in a String

Given a string which consists of either ‘.’ or any number. A ‘.’ in the string means that the cell is empty and if there… Read More »

## Convert a number of length N such that it contains any one digit at least ‘K’ times

Given the value ‘N’ which is length of a number ‘A’. Your task is to convert the digits such that at least ‘K’ times in… Read More »

## Subset array sum by generating all the subsets

Given an array of size N and a sum, the task is to check whether some array elements can be added to sum to N… Read More »