Skip to main content

Subsequences

Learn Subsequences (Recursion & Backtracking, Data Structures & Algorithms) with worked examples, diagrams and interview questions. Free on JavaSchoolLab.

Generating Subsequences with a Condition Subsequences generation uses the exact same include/exclude backtracking shape as subsets - the difference is usually a FILTER: only keep subsequences meeting some condition (a target sum, a specific length, alternating parity). This is where backtracking becomes genuinely useful over just enumerating everything.

More lessons in Recursion & Backtracking