Tap here to switch tabs
Problem
Submissions

Problem: Filter Characters by Frequency

med
30 min
Try to solve the Filter Characters by Frequency problem.

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

med
30 min
Try to solve the Filter Characters by Frequency problem.

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