Tap here to switch tabs
Problem
Submissions

Problem: Apply Operations to Make String Empty

med
30 min
Try to solve the Apply Operations to Make String Empty problem.

Statement

You are given a string s.

In one operation, you simultaneously remove the first occurrence of every distinct character present in s. This process is repeated until the string becomes empty.

Return the string s immediately before the last operation that makes it empty.

Constraints:

  • 1≤1 \leq s.length ≤5imes105\leq 5 imes 10^5

  • s consists only of lowercase English letters.

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Apply Operations to Make String Empty

med
30 min
Try to solve the Apply Operations to Make String Empty problem.

Statement

You are given a string s.

In one operation, you simultaneously remove the first occurrence of every distinct character present in s. This process is repeated until the string becomes empty.

Return the string s immediately before the last operation that makes it empty.

Constraints:

  • 1≤1 \leq s.length ≤5imes105\leq 5 imes 10^5

  • s consists only of lowercase English letters.