public ListNode merge(ListNode left,ListNode right){
        ListNode head = new ListNode(-1);
        ListNode node = head;
        while(left != null && right != null){
            if(left.val < right.val){
                node.next = left;
                left = left.next;
            }
            else{
                node.next = right;
                right = right.next;
            }
            node = node.next;
        }
        if(left == null)
            node.next = right;
        else
            node.next = left;
        return head.next;
    }