mirror of
https://github.com/TheAlgorithms/JavaScript.git
synced 2025-07-06 17:50:39 +08:00

* feat: Added Algo first unique char in a string. * Optimised algo to linear time complexity * removed double quotes * Review changes: if-else logic
10 lines
325 B
JavaScript
10 lines
325 B
JavaScript
import { firstUniqChar } from '../FirstUniqueCharacter'
|
|
|
|
describe('firstUniqChar', () => {
|
|
it('locates the index of first unique character in the string', () => {
|
|
expect(firstUniqChar('javascript')).toEqual(0)
|
|
expect(firstUniqChar('sesquipedalian')).toEqual(3)
|
|
expect(firstUniqChar('aabb')).toEqual(-1)
|
|
})
|
|
})
|