Opening your workspace…
Workspace/Coding room
Opening your workspace…
Nell hangs a bead wreath in the bakery window. Customers on the pavement see it from one side, bakers from the other, and the draught keeps turning it. Nell gives two wreaths the same catalogue number if a rotation or a flip makes their bead colours match. For a ring of n beads and a palette of distinct bead colours (given by the integer colours), count the catalogue numbers she needs. Neighbouring beads, including the last and first, must differ. Colours may go unused. Her stamp has six wheels, so return the count modulo 1000000 as an integer. Practice rank · 1 kyu (Brewery estimate).
3, 4OUTPUT4Each triangle needs three different colours. Choosing which of the four to leave out determines the whole wreath.
4, 2OUTPUT1Both alternating strings make the same wreath once it turns.
Count the valid strings fixed by each symmetry. A rotation leaves a shorter repeating ring. Which reflection axes would force two neighbours to match? Keep enough precision to divide by the group size before taking the six stamp digits.
function solve(n, colours) { // 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, 44