DEV Community

Cover image for Know the Difference: Subarray vs Substring vs Subsequence vs Subset
QuanticDev
QuanticDev

Posted on

Know the Difference: Subarray vs Substring vs Subsequence vs Subset

Today we are going to make a comparison of subarray vs substring vs subsequence vs subset. These are all similar concepts but have important differences. Especially in an interview situation, you need to be extra careful about your choice of wording. If a question asks you to return a subsequence and you return a subset, you might fail the interview. Or the interviewer can directly ask you about the differences between these concepts as they are quite important. Let me start by describing each concept with examples. Finally, I will give you a comparison table.

Video: https://www.youtube.com/watch?v=uzhN-QhzR2g
Article: http://quanticdev.com/algorithms/primitives/subarray-vs-substring-vs-subsequence-vs-subset

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more