github.com/gibsoncream/DRY-character
.
Fork this repo and then git clone
your forked repo to your computer.
Once you're happy with your solution, git push
and submit a pull request at
github.com/gibsoncream/DRY-character
.
Good coders don't ever repeat themlselves. Write a function nonRepeatingCharacter that takes a string input and return the first character that is not repeated anywhere else.
e.g. nonRepeatingCharacter('hello') ===> 'h'
To complicate things more, lower and uppercase characters are considered the same character, but your function will return the correct case.
e.g. nonRepeatingCharacter('Hello') ===> 'H'
If all the characters are repeated at least once or there are no characters, an empty string ('') should be returned.
Input => Output
---------------------------------------------------------------
nonRepeatingCharacter('whatever') == 'w'
nonRepeatingCharacter('CoDecoRs') == 'D'
nonRepeatingCharacter('aBbesA') == 'e'
To test your solution, run npm i
in the root directory
and then run npm t
to run the automated tests.
To submit your solution:
- If you're working on a forked repo, push your changes to your forked repo and submit a pull request to this repo.