Courses
Tutorials
Interview Prep
DSA
Practice Problems
C
C++
Java
Python
JavaScript
Data Science
Machine Learning
Courses
Linux
DevOps
Similar Topics
Web Technologies
32.1K+ articles
DSA
20.4K+ articles
Mathematical
5.1K+ articles
Arrays
4.2K+ articles
Strings
2.1K+ articles
Greedy
1.4K+ articles
Dynamic Programming
1.1K+ articles
Combinatorial
460+ articles
number-theory
424+ articles
Permutation and Combination
146+ articles
combinatorics
46 posts
Recent Articles
Count Number of Distinct Binary Strings After Applying Flip Operations
Last Updated: 29 May 2024
Given a binary string s and a positive integer k. In a operation you can repeatedly choose any substring of length k in s and flip all its characters (0s to 1s, 1s to 0s)....
read more
Strings
Picked
DSA
Microsoft
combinatorics
Ways to arrange N balls of K colors with no adjacent same colors
Last Updated: 23 July 2025
Given infinite balls of K distinct colors. Count the number of ways to arrange N balls in a line such that no two adjacent balls are of same color. Since the answer may be...
read more
Mathematical
Combinatorial
DSA
combinatorics
Binary Exponentiation
Count all ordered pairs (A, B) such that A and B are disjoint
Last Updated: 29 February 2024
Given an array arr[] of size n contains distinct elements, the task is to find the number of ordered pairs (A, B) that can be made where A and B are subsets of the given a...
read more
DSA
combinatorics
Geeks Premier League 2023
Count number of pairs of arrays (a, b) such that a[i] <= b[i]
Last Updated: 23 July 2025
Given two integers n and m, the task is to count the number of pairs of arrays (a, b) where both arrays have a length of m, contain integers between 1 and n (inclusive), a...
read more
Picked
DSA
combinatorics
Algorithms-Dynamic Programming
Geeks Premier League 2023
Count number of ways array can be partitioned such that same numbers are present in same subarray
Last Updated: 23 July 2025
Given an array A[] of size N. The Task for this problem is to count several ways to partition the given array A[] into continuous subarrays such that the same integers are...
read more
Geeks Premier League
DSA
Arrays
combinatorics
Geeks Premier League 2023
Find the number of ways to draw the last colored ball
Last Updated: 23 July 2025
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 dra...
read more
Picked
DSA
combinatorics
Algorithms-Dynamic Programming
binomial coefficient
Geeks Premier League 2023
Stars and Bars Algorithms for Competitive Programming
Last Updated: 28 May 2026
The Stars and Bars (also known as Balls and Urns) technique is a widely used method in Combinatorics, which is the branch of mathematics dealing with counting and arrangem...
read more
Picked
DSA
combinatorics
python-dict
binomial coefficient
SQL-PL/SQL
Java-HijrahDate
Python numpy-Random
Geeks Premier League 2023
Count Weird Triplets
Last Updated: 26 February 2024
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.Examples: Input: A[] = [5, 5, ...
read more
Combinatorial
DSA
combinatorics
math
python-dict
Scala-Arrays
Geeks Premier League 2023
Maximize the sum of all people's travel distances
Last Updated: 23 July 2025
Given a group of N people who hate each other such that each of them lives in a different city. The cities are connected by N-1 roads such that road[i] = {u, v, w} indicat...
read more
DSA
combinatorics
DFS
Counting City Trips with K Stops
Last Updated: 18 January 2024
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 highwa...
read more
Graph
Geeks Premier League
DSA
combinatorics
DFS
Data Structures
Geeks Premier League 2023
Number of ways to make N using product of M integers
Last Updated: 31 July 2023
Given two integers N (1 = N = 1e9) and M (M = 1e5), the task is to find the number of ways to represent the number N in terms of the product of M integers. Find the answer...
read more
Mathematical
DSA
combinatorics
sieve
prime-factor
Prime Number
Permutation and Combination
binomial coefficient
Count ways to choose Triplets of Pairs such that either first or second values are distinct
Last Updated: 23 January 2023
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 trip...
read more
Mathematical
Combinatorial
DSA
Arrays
combinatorics
cpp-pair
Count of binary string of length N with at least X 0s and Y 1s
Last Updated: 03 October 2025
Given three numbers N, X, and Y, find the count of unique binary strings of length N having at least X 0s and Y 1s.Examples:Input: N=5, X=1, Y=2Output: 25Input: N=3, X=1, ...
read more
Bit Magic
Combinatorial
DSA
combinatorics
binary-string
Permutation and Combination
Count of subsequences with sum two less than the array sum
Last Updated: 23 July 2025
Given an array vec[] of size N of non-negative integers. The task is to count the number of subsequences with the sum equal to S - 2 where S is the sum of all the elements...
read more
DSA
combinatorics
subsequence
Find sum of difference of maximum and minimum over all possible subsets of size K
Last Updated: 23 July 2025
Given an array arr[] of N integers and an integer K, the task is to find the sum of the difference between the maximum and minimum elements over all possible subsets of si...
read more
Sorting
Mathematical
Combinatorial
Blogathon
Blogathon-2021
DSA
Arrays
combinatorics
subset
1
2
3
4