PracHub
QuestionsPremiumLearningGuidesCheatsheetNEWCoaches
|Home/Coding & Algorithms/N/A

Compare Strings With Deletions

Last updated: May 5, 2026

Quick Overview

This question evaluates string processing and algorithmic optimization skills, specifically handling simulated deletions (backspace behavior) and performing comparisons under a strict auxiliary space constraint.

  • medium
  • N/A
  • Coding & Algorithms
  • Backend Engineer

Compare Strings With Deletions

Company: N/A

Role: Backend Engineer

Category: Coding & Algorithms

Difficulty: medium

Interview Round: Technical Screen

You are given two strings `s` and `t`. Each string may contain lowercase letters and the special character `#`. A `#` deletes the closest non-deleted character immediately before it, if such a character exists; otherwise it has no effect. Return whether the two strings are equal after all deletions are applied. You must implement the comparison without using extra space proportional to the input size. Aim for `O(1)` auxiliary space. Example: ```text Input: s = "ab#c", t = "ad#c" Output: true Explanation: Both strings become "ac". ``` ```text Input: s = "a#c", t = "b" Output: false Explanation: The first string becomes "c", while the second becomes "b". ```

Quick Answer: This question evaluates string processing and algorithmic optimization skills, specifically handling simulated deletions (backspace behavior) and performing comparisons under a strict auxiliary space constraint.

Related Interview Questions

  • Implement Linear Regression Training - N/A
N/A logo
N/A
Jan 23, 2026, 12:00 AM
Backend Engineer
Technical Screen
Coding & Algorithms
0
0

You are given two strings s and t. Each string may contain lowercase letters and the special character #. A # deletes the closest non-deleted character immediately before it, if such a character exists; otherwise it has no effect.

Return whether the two strings are equal after all deletions are applied.

You must implement the comparison without using extra space proportional to the input size. Aim for O(1) auxiliary space.

Example:

Input: s = "ab#c", t = "ad#c"
Output: true
Explanation: Both strings become "ac".
Input: s = "a#c", t = "b"
Output: false
Explanation: The first string becomes "c", while the second becomes "b".

Comments (0)

Sign in to leave a comment

Loading comments...

Browse More Questions

More Coding & Algorithms•More N/A•More Backend Engineer•N/A Backend Engineer•N/A Coding & Algorithms•Backend Engineer Coding & Algorithms
PracHub

Master your tech interviews with 7,500+ 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
  • Compare Platforms
  • Discord Community

Support

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

Legal

  • Privacy Policy
  • Terms of Service
  • About Us

© 2026 PracHub. All rights reserved.