Design a unique string generator for URL shortening with a character frequency threshold.
Unlock detailed company stats for this questionUpgrade
Design a class that generates unique strings for URL shortening. Strings use only lowercase a-z; a threshold T is given and the frequency of any character in a generated string must be <= T; each call returns a unique string; shorter strings must be returned before longer ones (order within the same length does not matter).
API: class URLShortener { URLShortener(int threshold); string getNext(); }
Example with T = 2: a, b, c, ..., z, then aa, ab, ac, ..., zz (every character appears at most 2 times).
Format · Google L4 onsite.
Community answers
No answers contributed by the community yet.
Related questions
Given a string, return all characters with frequency greater than 1.Related courses

Course

Course
Course
