Counting Problems and Combinatorics in DSA
Master counting techniques for DSA: permutations, combinations, Pascal's triangle, Catalan numbers, inclusion-exclusion, pigeonhole principle, and modular arithmetic.
9 posts · page 1 of 1
Master counting techniques for DSA: permutations, combinations, Pascal's triangle, Catalan numbers, inclusion-exclusion, pigeonhole principle, and modular arithmetic.
Solve the Missing Number problem with three approaches: hashing, Gauss sum formula, and XOR. Includes complexity analysis and interview tips.
Build Pascal's Triangle in O(n^2) time using simple row-by-row addition. Includes a clear diagram, edge cases, and complexity analysis.
Add one to a big integer stored as a digit array by walking from the back. Includes carry handling, the all-nines edge case, and complexity analysis.
Detect integer palindromes by reversing half the digits with integer math. Learn why string conversion is discouraged and how to handle negatives and trailing zeros.
Unique Paths in two ways — the O(m * n) grid DP that interviewers expect and the binomial-coefficient closed form that surprises them.
The essential math toolkit for interviews: Euclidean GCD, sieve of Eratosthenes, modular exponentiation, modular inverses, and common pitfalls.
A complete beginner's guide to numbers in JavaScript — arithmetic, the Math object, rounding, formatting, NaN, Infinity, and the floating-point quirk every developer must know.
A practical guide to integers, floats, arithmetic operators, operator precedence, the math module, and the floating-point gotchas every Python beginner should know.