Count Weird Triplets
Given an array A[] of integers. Your task is to output the count of triplets such that in each triplet, there can be at most 2 same elements....
read more
Counting City Trips with K Stops
Given n cities connected by (n-1) roads, each specified by [a, b, type], denoting a connection between cities a and b of a certain ‘type’ (0 for normal roads, 1 for highways). The task is to count the number of trips satisfying two conditions:...
read more
Find the number of ways to draw the last colored ball
Given an array balls[] representing the count of colored balls labeled from 1 to k, the task is to determine the number of ways to draw the last ball of color i before drawing the last ball of color i + 1 for all i from 1 to k – 1....
read more
Count ways to tile an N – length board using tiles of specified dimensions
Given an integer N, the task is to tile a board of dimensions N * 1 the task is to count the number of ways to tile a board using tiles of dimensions 1 * 1 and 2 * 1....
read more
Mean of minimum of all possible K-size subsets from first N natural numbers
Given two positive integers N and K, the task is to find the mean of the minimum of all possible subsets of size K from the first N natural numbers....
read more
Count pairs whose product contains single distinct prime factor
Given an array arr[] of size N, the task is to count the number of pairs from the given array whose product contains only a single distinct prime factor....
read more
Number of pairs whose product is a power of 2
Given an array arr[] consisting of N integers, the task is to count the total number of pairs of array elements from the given array such that arr[i] * arr[j] is the power of 2....
read more
Print all non-increasing sequences of sum equal to a given number x
Given a number x, print all possible non-increasing sequences with sum equals to x....
read more
Count of all possible ways to reach a target by a Knight
Given two integers N, M denoting N×M chessboard, the task is to count the number of ways a knight can reach (N, M) starting from (0, 0). Since the answer can be very large, print the answer modulo 109+7....
read more
Find an integral solution of the non-linear equation 2X + 5Y = N
Given an integer N representing a non-linear equation of the form 2X + 5Y = N, the task is to find an integral pair (X, Y) that satisfies the given equation. If multiple solutions exist, then print any one of them. Otherwise, print -1....
read more
Count unique paths with given sum in an N-ary Tree
Given an integer X and integer N, the task is to find the number of unique paths starting from the root in N-ary tree such that the sum of all these paths is equal to X. The N-ary tree satisfies the following conditions:...
read more
Count ways to choose Triplets of Pairs such that either first or second values are distinct
Given an array of pairs arr[] of size N (N ? 3) where each element of pair is at most N and each pair is unique, the task is to determine the number of ways to select triplets from the given N pairs that satisfy at least one of the following conditions:...
read more