Skip to content

Commit 4f99b7d

Browse files
authored
Add Mini Parser implementation and interface
1 parent 834be45 commit 4f99b7d

1 file changed

Lines changed: 51 additions & 0 deletions

File tree

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
/**
2+
* // This is the interface that allows for creating nested lists.
3+
* // You should not implement it, or speculate about its implementation
4+
* function NestedInteger() {
5+
*
6+
* Return true if this NestedInteger holds a single integer, rather than a nested list.
7+
* @return {boolean}
8+
* this.isInteger = function() {
9+
* ...
10+
* };
11+
*
12+
* Return the single integer that this NestedInteger holds, if it holds a single integer
13+
* Return null if this NestedInteger holds a nested list
14+
* @return {integer}
15+
* this.getInteger = function() {
16+
* ...
17+
* };
18+
*
19+
* Set this NestedInteger to hold a single integer equal to value.
20+
* @return {void}
21+
* this.setInteger = function(value) {
22+
* ...
23+
* };
24+
*
25+
* Set this NestedInteger to hold a nested list and adds a nested integer elem to it.
26+
* @return {void}
27+
* this.add = function(elem) {
28+
* ...
29+
* };
30+
*
31+
* Return the nested list that this NestedInteger holds, if it holds a nested list
32+
* Return null if this NestedInteger holds a single integer
33+
* @return {NestedInteger[]}
34+
* this.getList = function() {
35+
* ...
36+
* };
37+
* };
38+
*/
39+
/**
40+
* @param {string} s
41+
* @return {NestedInteger}
42+
*/
43+
var deserialize = function(s) {
44+
const stack = [];
45+
let num = "";
46+
47+
for (let i = 0; i<s.length; i++){
48+
const ch = s[i];
49+
if (ch == '[')
50+
}
51+
};

0 commit comments

Comments
 (0)