add: 链表的中间节点
This commit is contained in:
9
test/list/middle-of-the-linked-list.test.js
Normal file
9
test/list/middle-of-the-linked-list.test.js
Normal file
@ -0,0 +1,9 @@
|
||||
import { middleNode } from '../../src/list/middle-of-the-linked-list'
|
||||
import { arrToList } from './ListNode'
|
||||
|
||||
test('链表的中间节点', () => {
|
||||
expect(middleNode(arrToList([1]))).toEqual(arrToList([1]))
|
||||
expect(middleNode(arrToList([1, 2]))).toEqual(arrToList([2]))
|
||||
expect(middleNode(arrToList([1, 2, 3, 4, 5]))).toEqual(arrToList([3, 4, 5]))
|
||||
expect(middleNode(arrToList([1, 2, 3, 4, 5, 6]))).toEqual(arrToList([4, 5, 6]))
|
||||
})
|
Reference in New Issue
Block a user