Leetcode algorithm : linked list by using javascript

1. Node.js installation : https://nodejs.org/en/download/

2. hello world

   hello.js

      console.log("Hello world!");

    node hello.js

       Hello world!

 

3. add two number

Runtime: 116 ms, faster than 94.58% of JavaScript online submissions for Add Two Numbers.

    github

    function 形成是 javascript 的主要結構

    沒帶參數時, 是 undefined.

/**
* Definition for singly-linked list.
* function ListNode(val, next) {
* this.val = (val===undefined ? 0 : val)
* this.next = (next===undefined ? null : next)
* }    

var list = new ListNode();






留言

熱門文章