What you need to know to solve basic combinatorial generation problems you might encounter on coding interviews, with plenty of examples in Python.
Articles in the Algorithms category
-
-
From An Iterator of Iterators to Cantor's Paradise: A Deep Dive Into An Interview Question
A deep dive into flattening an iterator of iterators and a segue into set theory and some of its theorems based on the solutions to this problem, inspired by a coding interview question.
-
Generating All Balanced Parentheses: A Deep Dive Into An Interview Question
A deep dive into generating all balanced parentheses, inspired by a coding interview question.
-
Line Intersecting Maximal Number of Circles (Circle "Stabbing" Problem)
Developing an algorithm to find a line that intersects a maximal number of circles, given a set of circles. Based on an ACM ICPC regional competition problem.
-
Expected Running Time of Two Randomized Sort Algorithms (ACM ICPC 2013 PACNW Regional)
Computing the expected running time of two randomized sort algorithms for a given input array. This problem appeared in ACM ICPC 2013 PACNW regional competition.
-
Pattern Matching in Fibonacci Words (ACM ICPC World Finals 2012)
A discussion of calculating the number of occurrences of a given pattern in Fibonacci words, with a Java solution. Problem from the 2012 ACM ICPC world finals.
-
Common Substring Permutation
Short post on a simple problem on common subsequence permutations with a neat one-line Python solution.
-
Hundred Prisonors and a Room With a Light Switch
A hundred prisoners are given a challenge that might set them free. See if you can solve the puzzle involving a light switch and help them gain their freedom.
-
Interview Question: All Possible Products of a List of Primes
Interview question to list all possible products of a list of primes, with two Python solutions and a short discussion of the problem.
-
Interview Question: Fairness from Unfairness and Randomness Extraction
Interview question to use an unfair coin to simulate a fair one. The question is the same as extracting randomness from an unfair Bernoulli process. A Python implementation is given.
-
Interview Question: Grouping Words Into Anagrams
Simple Python solution to interview question to group words into anagrams.