Tap here to switch tabs
Problem
Submissions

Problem: Filter Characters by Frequency

Filter Characters by Frequency asks you to build a new string from s by keeping only characters whose total frequency is less than k, while preserving their original order.

Statement

Given a string s and an integer k, construct a new string by keeping only the characters whose total frequency in s is strictly less than k. The relative order of the remaining characters must be preserved.

Return the filtered string.

Constraints:

  • 1≤1 \leq s.length ≤100\leq 100

  • s consists of lowercase English letters.

  • 1≤1 \leq k ≤\leq s.length

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Filter Characters by Frequency

Filter Characters by Frequency asks you to build a new string from s by keeping only characters whose total frequency is less than k, while preserving their original order.

Statement

Given a string s and an integer k, construct a new string by keeping only the characters whose total frequency in s is strictly less than k. The relative order of the remaining characters must be preserved.

Return the filtered string.

Constraints:

  • 1≤1 \leq s.length ≤100\leq 100

  • s consists of lowercase English letters.

  • 1≤1 \leq k ≤\leq s.length