* function ListNode(x){
 *   this.val = x;
 *   this.next = null;
 * }
 */
/**
 * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可
 *
 * 
 * @param head ListNode类 
 * @return ListNode类
 */
function plusOne( head ) {
    // write code here
    let x = helper(head)
    if(x != 0){
        let node = new ListNode(x)
        node.next = head
        return node
    }
    return head
}
function helper(nd) {
        if(!nd) {
            return 1;
        }
        let sum = nd.val + helper(nd.next);
        nd.val = sum % 10;
        return parseInt(sum / 10);
    }
module.exports = {
    plusOne : plusOne
};

alt