An Interest In:
Web News this Week
- April 25, 2024
- April 24, 2024
- April 23, 2024
- April 22, 2024
- April 21, 2024
- April 20, 2024
- April 19, 2024
October 19, 2020 01:45 pm GMT
Original Link: https://dev.to/thepracticaldev/daily-challenge-297-loneliest-character-3akp
Daily Challenge 297 - Loneliest Character
Your task is to write a function loneliest() which accepts a string and will return the character that has the most spaces to its right and left.
Examples
'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']
Tests
loneliest('abc d ef g h i j ')
loneliest('abc')
loneliest(' abc d z f gk s ')
Good luck!
This challenge comes from aplefull on CodeWars. Thank you to CodeWars, who has licensed redistribution of this challenge under the 2-Clause BSD License!
Want to propose a challenge idea for a future post? Email [email protected] with your suggestions!
Original Link: https://dev.to/thepracticaldev/daily-challenge-297-loneliest-character-3akp
Share this article:
Tweet
View Full Article
Dev To
An online community for sharing and discovering great ideas, having debates, and making friendsMore About this Source Visit Dev To