Opening your workspace…
Workspace/Coding room
Opening your workspace…
A toffee maker has set her mixing bowls in a ring. She may tip two neighbouring bowls into one, paying one farthing per ounce in their combined batch. The new bowl takes their place in the ring. Return the least total fee to gather everything in one bowl. The last bowl needs no tipping. Practice rank · 3 kyu (Brewery estimate).
[1,8,1]OUTPUT12The two ones meet across the seam for two farthings. The final pour costs ten.
[7]OUTPUT0The toffee is already in its serving bowl.
Imagine cutting the ring at each possible seam. In a consecutive stretch, which two batches meet at its final pour?
function solve(weights) { // 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.
[1,8,1]12