Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function solve(input) {
- let width = Number(input.shift());
- let length = Number(input.shift());
- let heigth = Number(input.shift());
- let volume = width * length * heigth;
- let movedCartons = 0;
- while(true) {
- numCartons = input.shift();
- if(Number(numCartons) || numCartons == "undefined" || numCartons == "Done") {
- break;
- } else {
- movedCartons += numCartons;
- }
- }
- if(movedCartons > volume) {
- console.log(`No more free space! You need ${Math.abs(movedCartons - volume)} Cubic meters more.`);
- } else {
- console.log(`${Math.abs(movedCartons - volume)} Cubic meters left.`);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement