Even when all the conditions are right, the while loop is not getting entered
ListNode *t , *g, *i, *start, *end;
stack<ListNode*> st;
int count = 1;
i = head;
if(i->next ==NULL)return head;
while(count != m-1){
i = i->next;
count++;
}
start = i;
// printf("%d %d ", count, n);
// cout<<start->val<<" "<<i->val<<endl;
// printf("%d %d ", count, n);
while(count < n){ //THIS WHILE LOOP
cout<<"hello";
cout<<i->val<<" before end";
i = i->next;
count++;
st.push(i);
}
end = i->next;
printf("%d %d", start -> val, st.top()->val);
g= start;
while(!st.empty()){
t= st.top();
st.pop();
g->next = t;
g= t;
}
g->next = end;
}