Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
language: node_js
node_js:
- "6"
- "8"

addons:
chrome: stable

services:
- xvfb

before_script:
- "export DISPLAY=:99.0"
- "sh -e /etc/init.d/xvfb start"
- sleep 3 # give xvfb some time to start

before_install:
npm install karma-cli -g
npm install karma-cli -g

script:
karma start karma.conf.js --single-run
39 changes: 39 additions & 0 deletions quz/quz.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,22 @@
*/
function dcate(A, B) {
/** Fill in here **/
/**
* 思路:
* 1. 循环找到A.tail的末尾(null)
* 2. 在末尾.tail加上B
*/

let leaf = A;

while (leaf.tail) {
leaf = leaf.tail;
}

leaf.tail = B;

return A;

}

/**
Expand All @@ -24,4 +40,27 @@ function dcate(A, B) {
*/
function sub(L, start, len) {
/** Fill in here **/
/**
*
*/
let result = new List(L.head, L.tail);
let index = 0;

let temp;

while (index <= start + len - 1) {
if(index < start) {
result = result.tail;
temp = result;
} else if (index === start + len - 1) {
temp.tail = null;
} else {
temp = temp.tail;
}

index += 1;
};

return result;

}