add: 最高频率的IP

This commit is contained in:
2020-05-19 05:59:30 +08:00
parent 57045d7772
commit 34a76e22b9
3 changed files with 29 additions and 0 deletions

View File

@ -0,0 +1,6 @@
import { highestFrequency } from '../../src/array/highest-frequency-ip'
test('最高频率的IP', () => {
expect(highestFrequency(['192.168.1.1', '192.118.2.1', '192.168.1.1'])).toEqual('192.168.1.1')
expect(highestFrequency(['192.168.1.1', '192.118.2.1', '192.168.1.1', '192.118.2.1', '192.118.2.1'])).toEqual('192.118.2.1')
})