algorithm: ZFunction (#1239)

* algorithm: ZFunction

* made requested changes

* corrected spelling mistakes

* made requested changes
This commit is contained in:
Adrito Mukherjee
2022-10-31 22:12:06 +05:30
committed by GitHub
parent cc0700f122
commit 7fb121508d
2 changed files with 49 additions and 0 deletions

View File

@ -0,0 +1,8 @@
import zFunction from '../ZFunction'
test('Testing zFunction', () => {
expect(zFunction('aabxaayaab')).toEqual([10, 1, 0, 0, 2, 1, 0, 3, 1, 0])
expect(zFunction('aabxaabxcaabxaabxay')).toEqual([
19, 1, 0, 0, 4, 1, 0, 0, 0, 8, 1, 0, 0, 5, 1, 0, 0, 1, 0
])
})