Given a ternary string S consisting of only three characters, the task is to find the count of ordered triplets (i, j, k) such that… Read More

# Category Archives: Combinatorial

Given two integers N and M (1 ≤ N, M ≤ 100) denoting the total number of 1s and 0s respectively. The task is to… Read More

Given an integer N denoting the number of elements, the task is to find the number of ways to divide these elements equally into groups… Read More

Given an integer array arr[] of size N and a positive integer K, the task is to count all the pairs in the array with… Read More

Given a String ph[], the task is to find the absolute difference of consecutive elements and insert the result in between the consecutive elements. By… Read More

Given two integers N(denoting number of ‘1’) and M(denoting number of ‘0’). The task is to maximize the number of “001” or “110” patterns that… Read More

Given N and M number of points on the straight line, denoting the positions of the customers and vendors respectively. Each vendor provides service to… Read More

Given an array speed[] of size N denoting the speed of N cars moving on an infinitely long single lane road (i.e. no overtaking is… Read More

Given an integer N which depicts the number of stairs, the task is to count the number of ways to reach Nth stair by taking… Read More

Given a n × m binary matrix, count the number of sets where a set can be formed one or more same values in a… Read More

Given an array arr[] and an integer N, the task is to find the maximum number of pairs that can be formed such that ith… Read More