Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function solve(input, arrBoom) {
- let [specialNum, boomNum] = arrBoom;
- let sum = 0
- for (let i = 0; i < input.length; i++) {
- input.map(Number)
- if (input.includes(specialNum)) {
- let index = input.indexOf(specialNum)
- let del = (boomNum * 2) + 1
- input.splice(index - boomNum, del)
- }
- }
- for (let el of input) {
- sum += el
- }
- console.log(sum);
- }
- // solve([1, 7, 7, 1, 2, 3],
- // [7, 1])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement