Untitled

 avatar
unknown
plain_text
2 years ago
1.6 kB
5
Indexable
// let gets = this.gets || ((arr, index) => () => arr[index++])(input, 0);
// let current = gets().split(' ');
// let next = gets().split(' ');
// let i = 0;
// let length = current.length > next.length ? current.length : next.length;

// while(i < length){
//     let comparator = "-";

//     if(!current[i] && !next[i]){
//         i++;
//         continue;
//     }

//     if(current[i] === undefined){
//         current[i] = "x";
//     }
    
//     if(next[i] === undefined){
//         next[i] = "x";
//     }

//     if(current[i] === next[i]){
//         comparator = "+";
//     }
    
//     print(comparator + ` ${current[i]} ${next[i]}`);
//     i++;
// }


// let input = [1, 2, 4, 6, 7, 10];
// let n = input.length;
// let i = 0;
// let maxRank = input[n-1];
// let shelf1 = [];
// let shelf2 = [];
// let shelf3 = [];
// let shelf4 = [];

// while(i < n){
//     let prize = input[i];
    
//     if(prize > maxRank * 0.9){
//     shelf1.push(prize);
//     } else if(prize > maxRank * 0.5 && prize <= maxRank * 0.9){
//     shelf2.push(prize);
//     } else if(prize >= maxRank * 0.2 && prize <= maxRank * 0.5){
//     shelf3.push(prize);
//     } else {
//     shelf4.push(prize);
//     }
    
// i++;
// }
// console.log(shelf1, shelf2, shelf3, shelf4);
// console.log(printShelf(shelf1));
// console.log(printShelf(shelf2));
// console.log(printShelf(shelf3));
// console.log(printShelf(shelf4));

// function printShelf(shelf) {
//     if (shelf.length) {
//         return shelf.reverse().join(' ');
//         }
    
//     return 'empty';
// }
Editor is loading...