← Back to challenges

Single Occurrence

JavaScriptHardlanguage_fundamentalsstrings

Instructions

Create a function that, given a string str, finds a letter that has a single occurrence. Return the letter in uppercase. If the input is empty, return an empty string "".

Examples

singleOccurrence("EFFEAABbc") ➞ "C"

singleOccurrence("AAAAVNNNNSS") ➞ "V"

singleOccurrence("S") ➞ "S"

Notes

The function will not be case sensitive.

javascript
Loading editor…
to run
Walks through the solution with reasoning and edge cases.
Next: Enharmonic Equivalents