Opening your workspace…
Workspace/Coding room
Opening your workspace…
At closing time the brewery rolls out its barrel organ. Each barrel carries a batch number, and each digit plays one note. The crank is on the wrong end, so the organ plays the rightmost digit first. Given the batch number, return an array of its digits in playing order. Zero is the little brass triangle. Give it its turn, even when the whole batch number is 0.
1200OUTPUT[0,0,2,1]The triangle sounds twice before the 2 and the 1.
407OUTPUT[7,0,4]The triangle sounds between the 7 and the 4.
Which digit would the crank reach first in batch 120?
/** @param {number} batch * @returns {number[]} */ function solve(batch) { // 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.
1200[0,0,2,1]