add: 数据流中第一个唯一的数字

This commit is contained in:
2020-05-14 18:03:49 +08:00
parent 8f84fc8c66
commit 9c2a165583
3 changed files with 35 additions and 1 deletions

View File

@ -0,0 +1,7 @@
import { firstUniqueNumber } from '../../src/array/first-unique-number-in-data-stream'
test('数据流中第一个唯一的数字', () => {
expect(firstUniqueNumber([1, 2, 2, 1, 3, 4, 4, 5, 6], 5)).toBe(3)
expect(firstUniqueNumber([1, 2, 2, 1, 3, 4, 4, 5, 6], 7)).toBe(-1)
expect(firstUniqueNumber([1, 2, 2, 1, 3, 4], 3)).toBe(3)
})