The N Queen is the problem of placing N chess queens on an N×N chessboard so that no two queens attack each other. For example, following is a solution for 4 Que...

Share

Given A and B, the task is to find the number of possible values that X can take such that the given modular equation (A mod X) = B holds good. Here, X is also called...

Share

Given two integers n and p, find the number of integral solutions to x2 = 1 (mod p) in the closed interval [1, n].
Examples:
Input : n = 10, p = 5
Output : 4
There a...

Share

Given a number n, find number of ways we can add 3 non-negative integers so that their sum is n.
Examples :
Input : n = 1
Output : 3
There are four ways to get sum 1...

Share

Given a linear equation of n variables, find number of non-negative integer solutions of it. For example,let the given equation be “x + 2y = 5”, soluti...

Share