Quick Overview

Remove repeated lowercase letters so each distinct character appears once in the lexicographically smallest valid subsequence. A monotonic stack, remaining-occurrence information, and a membership set produce a linear-time solution without enumerating subsequences.

Remove Duplicate Letters Lexicographically

Company: ByteDance

Role: Software Engineer

Category: Coding & Algorithms

Difficulty: medium

Interview Round: Technical Screen

Overview: Remove repeated lowercase letters so each distinct character appears once in the lexicographically smallest valid subsequence. A monotonic stack, remaining-occurrence information, and a membership set produce a linear-time solution without enumerating subsequences.

Loading…