Opening your workspace…
Workspace/Coding room
Opening your workspace…
Mags rents attic space to moths. Each tenant sleeps under a square quilt and owes one button per patch. Given the side length of each quilt in patches, return the total rent in buttons. A moth with a three-patch-wide quilt pays for all three rows. Mags allows no discount for holes.
[3,1,2]OUTPUT14Nine buttons, one button, and four buttons land in the saucer.
[]OUTPUT0Every moth is away for the summer.
Work out the rent for one quilt before adding it to the bill.
/** @param {number[]} sides * @returns {number} */ function solve(sides) { // Write your answer here. }
Tab inserts two spaces. Shift+Tab outdents. Use the arrow keys and Tab to choose a suggestion. Press Escape, then Tab, to leave the editor. Press Control or Command with apostrophe to run samples or with Enter to submit.
[3,1,2]14