Problem Brief
Most Unique Elements (Part 1 :)
OA
Your goal is to find unlikely characters in a group of strings.
Given a list of strings, select the strings where the most common character has the smallest proportion in its string. If multiple strings have the same proportion, select all the strings with the smallest proportion.
Return a new string composed of the characters that are only present in the selected strings.
❤️🔥 Thanks a lot to the friend who shared the source! ❤️🔥
1Example 1
Input
group = ["aba", "ab", "abbcdd"]
Output
"cdd"
Explanation
- "aba": most common character is 'a', with proportion 2/3
- "ab": most common characters are 'a' and 'b', with proportion 1/2
- "abbcdd": most common character are 'b' and 'd', with proportion 2/6
The smallest proportion is 2/6, so we select the last string "abbcdd" and return the characters that are only present in this string: "cdd"