Opening your workspace…
Workspace/Coding room
Opening your workspace…
It’s snack time in the penguins’ Madagascar enclosure. Private tips out the fish crates one at a time. For each crate, he deals its fish one by one around the squad in this repeating order — Skipper, Kowalski, Rico, Private. Skipper gets the first fish of the day. When a crate runs out, the next crate starts with whoever was due the next fish. Given a list of nonnegative whole fish counts, one per crate, return the four penguins’ totals in dealing order. For [3, 0, 2], Private gets the first fish from the last crate and Skipper gets the second, so return [2, 1, 1, 1]. An empty list gives four zeros.
[3,0,2]Output[2,1,1,1]Five fish make one full round and one extra fish for Skipper.
[]Output[0,0,0,0]The squad receives no fish.
Every group of four fish gives one to each penguin.
function solve(crates) { // Write your solution 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.