Code Room
CodingHardcod-g933
Subject Interval dpLevel Senior–Staff~35 minCommon in Algorithms & data structures interviewsIndustries Software development

Question

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.

Vibe coding: describe the solution in plain language (or narrate it) and the coach grades your approach. Generating runnable code from your description is coming next.

Run or narrate your approach, then ask the coach.