Code RoomPizza slice game
HardPrep Room Coding #1496

Pizza slice game

CodingAlgorithms & data structuresSenior–Staff~35 min

There is a circular pizza with 3n slices of given sizes. You and two friends pick in rounds: you pick a slice, then your friend Alice (always) takes the slice clockwise-adjacent to yours, then friend Bob takes the slice counter-clockwise-adjacent. This repeats n times until all slices are gone. Maximize the total size of the slices you pick. The list length is a multiple of 3, between 3 and 500.

Implement
max_pizza_slices(slices: list[int]) → int
Examples
in[[1,2,3,4,5,6]]out10
What a strong answer looks like

State your approach and its time/space complexity out loud before you optimize. Handle the edge cases (empty input, duplicates, overflow), and say why you chose this over the brute force. Green tests are the floor, not the grade.

0:00 of about 35 min
InputExpectedGot
[[1,2,3,4,5,6]]10not run yetsample