func reversePrint(_ head: ListNode?) -> [Int] {
var res: [Int] = [], node = head
while let n = node {
res.insert(n.val, at: 0)
node = node?.next
}
return res
}
func reversePrint(_ head: ListNode?) -> [Int] {
guard let node = head else {
return []
}
return reversePrint(head?.next) + [node.val]
}