首尾交换
Closed this issue · 1 comments
Zhang1506900502 commented
function reverseArray(head) {
let result = [];
while (head != null){
result.push(head.Val)
head = head.Next
}
for(let i = 0; i< result.length/2;i++){
let temp = result[i];
result[i] = result[result.length -1 - i];
result[result.length-1-i] = temp
}
console.log(result);
return result
}
eveningwater commented
提交pull requests