Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
function firstNonRepeatingLetter(string) {
// Add your code here
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
describe('FirstNonRepeatingLetter function', function() {
it('should return result correctly', function() {
expect(firstNonRepeatingLetter('a')).toEqual('a');
expect(firstNonRepeatingLetter('stress')).toEqual('t');
expect(firstNonRepeatingLetter('moonmen')).toEqual('e');
});

it('should return empty string if string contains all repeating characters', function() {
expect(firstNonRepeatingLetter('aaaaaaa')).toEqual('');
});
});
23 changes: 23 additions & 0 deletions katas/first-non-repeating-letter/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
####Description:

Write a function named firstNonRepeatingCharacter that takes a string input, and returns the first character that is not repeated anywhere in the string.

For example, if given the input 'stress', the function should return 't', since the letter t only occurs once in the string, and occurs first in the string.

As an added challenge, upper- and lowercase letters are considered the same character, but the function should return the correct case for the initial letter.

If a string contains all repeating characters, it should return the empty string ("").

####Example:

```js

firstNonRepeatingCharacter('sTreSS') // 'T'

```

See [tests in first-non-repeating-letter_test.js](https://github.com/AlexVvx/code-wars/tree/master/katas/first-non-repeating-letter/first-non-repeating-letter_test.js)

Good luck

#####[Original Kata](https://www.codewars.com/kata/first-non-repeating-letter)