Bloomberg | Phone Screen | Cool String
Anonymous User
3203
Feb 26, 2024
Given a string,
It can be cool string if
1. All Characters have same frequency
2. If we can remove only 1 character and make it a cool string
Example:
- aaabbb -> true
Explanation: Both a and b have same frequencies - aaabbbcccc -> true
Explanation: a and b occur 3 times but c occurs 4 times, we can remove 1 c to make this into a cool string - aaabbbccccdddd -> false
Explanation: a and b occur 3 times but c and d occur 4 times we'd have to remove 1 c and 1 d to make it cool string - aabbcccdddeeee -> false
Explanation: a and b occur 2 times, c and d occur 3 times, and e occurs 4 times. We'd have to remove 1 c and 2 e's to make it cool string
Comments (5)


