DEV Community

Discussion on: Daily Challenge #297 - Loneliest Character

Collapse
 
mellen profile image
Matt Ellen • Edited

Only the last example make sense.

There has been some corruption and information removal. The actual examples are as follows:

                     'a b  c' => ['b']
        'a bcs           d k' => ['d']
'    a b  sc     p     t   k' => ['p']
                'a  b  c  de' => ['b', 'c']
    '     a  b  c de        ' => ['b']
                        'abc' => ['a', 'b', 'c']
Enter fullscreen mode Exit fullscreen mode

Also there is the important note as follows:

String can have leading/trailing spaces, you should not count them;

Strings contain only unique characters from a to z;

Order of characters in array doesn't matter;

Collapse
 
qm3ster profile image
Mihail Malo

So first and last non-whitespace character are less likely to be lonely, because they don't have space on one side?
For example, why is the first answer not ['b', 'c']? 'c' is as far from the other letters as it gets!

Collapse
 
mellen profile image
Matt Ellen • Edited

I didn't write the rules, just copied them from the other site :-Þ

Thread Thread
 
qm3ster profile image
Mihail Malo

RIP