PracHub
QuestionsCoachesLearningGuidesInterview Prep

Quick Overview

This question evaluates understanding of string algorithms and subsequence detection, focusing on sequence traversal, edge-case handling, and time/space complexity reasoning.

  • medium
  • Atlassian
  • Coding & Algorithms
  • Software Engineer

Check if one string is a subsequence of another

Company: Atlassian

Role: Software Engineer

Category: Coding & Algorithms

Difficulty: medium

Interview Round: Technical Screen

Given two strings `s` and `t`, determine whether `s` is a **subsequence** of `t`. A subsequence keeps relative order but does not require contiguous characters. #### Input - `s`: a string (may be empty) - `t`: a string (may be empty) #### Output - Return `true` if `s` is a subsequence of `t`, otherwise return `false`. #### Examples - `s = "abc"`, `t = "aabzc"` → `true` (pick `a` at index 1, `b` at index 2, `c` at index 4) - `s = "axc"`, `t = "ahbgdc"` → `false` #### Constraints - `0 ≤ |s|, |t| ≤ 10^5` (assume ASCII letters) Follow-up (optional): If you need to answer this query for **dozens** of different `s` strings against the same `t`, what preprocessing (if any) would you do?

Quick Answer: This question evaluates understanding of string algorithms and subsequence detection, focusing on sequence traversal, edge-case handling, and time/space complexity reasoning.

Return whether s is a subsequence of t.

Constraints

  • Inputs are Python literals matching the function signature.
  • Return a deterministic exact-match value.

Examples

Input: ('abc','aabzc')

Expected Output: True

Explanation: abc appears in order.

Input: ('axc','ahbgdc')

Expected Output: False

Explanation: x cannot be matched.

Input: ('', 'anything')

Expected Output: True

Explanation: The empty string is a subsequence.

Input: ('abc','')

Expected Output: False

Explanation: A non-empty string is not a subsequence of empty t.

Hints

  1. Clarify edge cases before coding.
  2. Keep outputs deterministic when several valid answers exist.
Last updated: Jun 27, 2026

Loading coding console...

PracHub

Master your tech interviews with 8,000+ real questions from top companies.

Product

  • Questions
  • Learning Tracks
  • Interview Guides
  • Resources
  • Premium
  • For Universities
  • Student Access

Browse

  • By Company
  • By Role
  • By Category
  • Topic Hubs
  • SQL Questions
  • AI Coding Questions
  • Compare Platforms
  • Discord Community

Support

  • support@prachub.com
  • (916) 541-4762

Legal

  • Privacy Policy
  • Terms of Service
  • About Us

© 2026 PracHub. All rights reserved.

Related Coding Questions

  • Find a secret word using match feedback - Atlassian (hard)
  • Compute a moving average on a stream - Atlassian (hard)
  • Implement sliding-window rate limiter function - Atlassian (medium)
  • Implement sequential and parallel URL requests - Atlassian (medium)
  • Merge intervals and design rating APIs - Atlassian (medium)