Skip to content

Category Archives: Combinatorial

Given an array arr[] consisting of N positive integers, the task is to find the sum of Bitwise AND of all possible triplets (arr[i], arr[j],… Read More
Given an array A[] consisting of N non-negative integers, and an integer K, the task is to find the number of ways ‘+’ and ‘-‘… Read More
Given two N-digit positive integers X and Y, the task is to find the minimum absolute difference between both the integers possible by rearranging the… Read More
Given an array arr[] consisting of N strings, an array letter[] consisting of M lowercase characters, and an array score[] such that score[i] is the… Read More
Given two integers N and K, the task is to find the total number of ways of representing N as the sum of positive integers… Read More
Given an integer N, the task is to print all distinct permutations of the number N. Examples: Input: N = 133Output: 133 313 331Explanation:There are… Read More
Given a string S of length N, consisting of lowercase characters containing reordered English representations of digits [0 – 9], the task is to print… Read More
Given a positive integer N, the task is to find the number of Antisymmetric Relations on the given set of N elements.  Since the number… Read More
Given a positive integer N, the task is to find the number of Asymmetric Relations in a set of N elements.  Since the number of… Read More
Given a binary string S, the task is to print all distinct decimal numbers that can be obtained by generating all permutations of the binary… Read More
Given a string S, the task is to print permutations of all words in a sentence. Examples: Input: S = “sky is blue”Output:  sky is… Read More
Given an integer N, representing objects placed adjacent to each other, the task is to count the number of ways to remove objects such that… Read More
Given two integers N and K, the task is to find all valid combinations of K numbers that adds up to N based on the… Read More
Given an array arr[] consisting of N positive integers, the task is to find the maximum sum of Bitwise AND of same-indexed elements of permutation… Read More