-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDesignSkiplist.js
More file actions
59 lines (45 loc) · 1.15 KB
/
DesignSkiplist.js
File metadata and controls
59 lines (45 loc) · 1.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
// https://leetcode-cn.com/problems/design-skiplist/
var Test = require('./Common/Test');
var List = require('./Common/List');
function ListNode(val) {
this.val = val;
this.next = null;
}
var Skiplist = function () {
this.levels = [];
// this.root = new ListNode();
this.count = 0;
};
/**
* @param {number} target
* @return {boolean}
*/
Skiplist.prototype.search = function (target) {
this.count++;
};
/**
* @param {number} num
* @return {void}
*/
Skiplist.prototype.add = function (num) {
};
/**
* @param {number} num
* @return {boolean}
*/
Skiplist.prototype.erase = function (num) {
};
/**
* Your Skiplist object will be instantiated and called as such:
* var obj = new Skiplist()
* var param_1 = obj.search(target)
* obj.add(num)
* var param_3 = obj.erase(num)
*/
function test(ops, params) {
Test.testWithInstructions(ops, params);
}
test(["Skiplist", "add", "add", "add", "search", "add", "search", "erase", "erase", "search"],
[[], [1], [2], [3], [0], [4], [1], [0], [1], [1]]);
// ["Skiplist","add","add","add","search","add","search","erase","erase","search"]
// [[],[1],[2],[3],[0],[4],[1],[0],[1],[1]]