/**
 * struct ListNode {
 *	int val;
 *	struct ListNode *next;
 *	ListNode(int x) : val(x), next(nullptr) {}
 * };
 */
class Solution {
public:
    /**
     * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可
     *
     * 
     * @param arr int整型vector 
     * @return ListNode类
     */
    ListNode* vectorToListnode(vector<int>& arr) {
        if (arr.empty()) {
            return nullptr;
        }
        ListNode* head=new ListNode(arr[0]);
        ListNode* temp=head;
        for (int i=1; i<(arr.size());++i) {
            temp->next=new ListNode(arr[i]);
            temp=temp->next;
        }
        temp->next=nullptr;
        return head;// write code here
    }
};