* function ListNode(x){
* this.val = x;
* this.next = null;
* }
*/
/**
*
* @param head ListNode类
* @param m int整型
* @param n int整型
* @return ListNode类
*/
function reverseBetween( head , m , n ) {
// write code here
let newHead=new ListNode(0)
newHead.next=head
head=newHead
let p=head,q=head.next
for(let i=1;i<m;i++){
p=p.next
}
q=p.next
for(let i=m;i<n;i++){
let temp=p.next
p.next=q.next
q.next=q.next.next
p.next.next=temp
}
return head.next
}
module.exports = {
reverseBetween : reverseBetween
};