@ParasArora/

service lane

Nodejs

No description

fork
loading
Files
  • index.js
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
function serviceLane(n, width, cases) {
  let result = [];

  for(let i = 0; i < cases.length; i++){
    let lane = width.slice(cases[i][0], cases[i][1]+1);
    let min = Math.min(...lane);

    result.push(min);
    
  }
  return result;

}

serviceLane(8, [2, 3, 1, 2, 3, 2, 3, 3], [
  [0, 3],
  [4, 6],
  [6, 7],
  [3, 5],
  [0, 7]
])
node v10.16.0