TwoAnswers Logo
  • Home
  • Career
  • Salary
Skip to content
Previous
Complete Guide to Software Industry Certifications & Skill Badges
Next
Database Normalization: A Real-World Walkthrough
Related
Explore More Topics
Discover related content that might interest you.

Education: Top 100 EAMCET Colleges (Hyderabad)

Complete BSc Guide — Hyderabad, Telangana

Student Developer Perks: Free & Discounted List (2025)

Full-Stack Web Dev — Complete Skill Matrix (Junior → Principal)

Does God Exist?: How Belief Shaped Humanity

Artificial Intelligence — The Complete Guide

Explore All Categories
Previous
Complete Guide to Software Industry Certifications & Skill Badges
Next
Database Normalization: A Real-World Walkthrough
Navigation
Current path

Previous

Best Laptops in Hyderabad, IndiaUltimate Guide to Project Management and Agile CertificationsComplete Guide to Software Industry Certifications & Skill Badges

Current

Subarrays, Subsequences, Subsets, Combinations & Permutations - Math Cheat Sheet

Next

Database Normalization: A Real-World WalkthroughEnglish: A Simple TutorialDSA: Learning Path from Arrays to Graphs

About TwoAnswers

TwoAnswers Logo

AI-powered learning and career tools — adaptive study, coaching, and job-ready skill tracks for ambitious builders.

Learn

  • Career Accelerator

Tools

  • Salary Calculator
  • LC Rankings

Legal

  • Report Security Issue
  • Contact

© 2026 TwoAnswers.com. All rights reserved.

Made with by the TwoAnswers.com team

Welcome!
A lot more exciting content is coming soon.
Please verify this information
Please verify this platform information with authenticated sources before using it in production environments.
Subarrays, Subsequences, Subsets, Combinations & Permutations - Math Cheat Sheet

Subarrays, Subsequences, Subsets, Combinations & Permutations - Math Cheat Sheet

If you’ve ever mixed up “subsequence” with “subset” during an interview or debugging session, you’re not alone. These terms get thrown around constantly in coding interviews, LeetCode problems, and algorithm discussions — and the differences are subtle but critical.

Here’s the ultimate comparison table that I wish I had taped above my monitor years ago.

The Ultimate Summary Table

Term# ElementsOrder Preserved?Contiguous?Total Count
Subarray / Substring0 to nYes (exact original order)Yesn(n+1)/2 + 1 (incl. empty)
Subsequence0 to nYes (relative original order)No (can skip)2ⁿ (incl. empty)
Subset0 to nNo (order irrelevant)No2ⁿ (incl. empty set)
Combinationexactly kNo (order irrelevant)NoC(n,k) = n! / (k!(n−k)!)
Permutation / k-Permutationn (or exactly k)Yes (order matters, all distinct)Non! or P(n,k) = n! / (n−k)!

Quick Rules of Thumb (The 3 Key Differences Everyone Gets Wrong)

ComparisonThe Crucial Difference
Subarray vs SubsequenceSubarray = contiguous block
Subsequence = can skip elements
Subsequence vs SubsetSubsequence respects relative order
Subset doesn’t care about order at all
Subset vs CombinationSubset = any size (0 to n)
Combination = fixed size k only

Real Example with [1, 2, 3]

TypeAll Possible Results
Subarrays (must be contiguous)[], [1], [2], [3], [1,2], [2,3], [1,2,3]
Subsequences (order preserved, can skip)[], [1], [2], [3], [1,2], [1,3], [2,3], [1,2,3]
✓ [1,3] is valid  ✗ [3,1] is not (breaks order)
Subsets (order doesn’t matter){}, {1}, {2}, {3}, {1,2}, {1,3}, {2,3}, {1,2,3}
Combinations (k=2){1,2}, {1,3}, {2,3}
Permutations (full n=3)[1,2,3], [1,3,2], [2,1,3], [2,3,1], [3,1,2], [3,2,1]

One-Liner to Remember Forever

“Subarray = slice of cake (contiguous) Subsequence = picking some cherries while keeping their left-to-right order Subset = throwing cherries into a bowl (order doesn’t matter) Combination = picking exactly k cherries for a recipe Permutation = arranging the cherries in a line — every different order counts”

Drop this table. You’ll look like a wizard.