Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function solve(input) {
- let result = input.map(Number);
- let currentNum = 0;
- let multi = 1;
- let arr = [];
- let variable = 1;
- let isMulty = false;
- for (let i = 0; i < result.length; i++) {
- if (result[i] <= 9 && result[i] > -1) {
- for (let j = 1; j <= result[i]; j++) {
- variable *= result[j + i];
- isMulty = true;
- }
- if (!isNaN(variable)) {
- arr.push(variable);
- }
- variable=1;
- }
- }
- if (isMulty) {
- let max = Math.max.apply(Math, arr);
- console.log(max);
- }
- else {
- console.log(0);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement