Advertisement
diela33

Untitled

Feb 4th, 2023
996
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function solve(input, arrBoom) {
  2.     let [specialNum, boomNum] = arrBoom;
  3.     let sum = 0
  4.     for (let i = 0; i < input.length; i++) {
  5.         input.map(Number)
  6.         if (input.includes(specialNum)) {
  7.             let index = input.indexOf(specialNum)
  8.             let del = (boomNum * 2) + 1
  9.             input.splice(index - boomNum, del)
  10.         }
  11.  
  12.     }
  13.     for (let el of input) {
  14.         sum += el
  15.     }
  16.  
  17.     console.log(sum);
  18. }
  19. // solve([1, 7, 7, 1, 2, 3],
  20.  
  21. // [7, 1])
  22.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement