Fairly simple solution I think


#1
ListNode* lowList = new ListNode(0);
ListNode* highList = new ListNode(0);
ListNode* lowListBegin = lowList;
ListNode* highListBegin = highList;
while (A != NULL)
{
    if (A->val >= B)
    {
        highList->next = new ListNode(A->val);
        highList = highList->next;
    }
    else
    {
        lowList->next = new ListNode(A->val);
        lowList = lowList->next;
    }
    A = A->next;
}

lowList->next = highListBegin->next;
return lowListBegin->next;

#3

cant we just add the linklists present to a high list and then join whats remaining of A; better space complexity achieved