this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

at main 26 lines 545 B view raw
1module.exports = { 2 floorCount: function(input) { 3 var floor = 0; 4 5 input.split('').forEach((movement) => { 6 if (movement === '(') floor++; 7 if (movement === ')') floor--; 8 }); 9 10 return floor; 11 }, 12 entersBasementAt: function(input) { 13 var floor = 0, 14 basementAt = null; 15 16 input.split('').forEach((movement, idx) => { 17 if (movement === '(') floor++; 18 if (movement === ')') floor--; 19 if (!basementAt && floor === -1) { 20 basementAt = idx + 1; 21 } 22 }); 23 24 return basementAt; 25 } 26};