add: K个一组翻转链表

This commit is contained in:
2020-05-16 19:50:31 +08:00
parent 5593f3e2c7
commit 55ff39a1c3
4 changed files with 75 additions and 0 deletions

View File

@ -15,3 +15,13 @@ export const arrToList = (arr) => {
return head
}
export const listToArr = (list) => {
const arr = []
while (list) {
arr.push(list.val)
list = list.next
}
return arr
}