def findValidSizes(memoryBlocks: list[int]) -> list[int]:
There are n memory blocks, and the size of the i-th block is memoryBlocks[i] (0 ≤ i < n).
The operation: select an index x and increase memoryBlocks[x] by 1, but only if memoryBlocks[x] is less than n - 1.
The MEX (minimum excluded value) of the array is the smallest non-negative integer not present in it; the prompt calls it a Valid Size. Return every Valid Size that can be reached, sorted in ascending order.
Complete findValidSizes(memoryBlocks), which returns int[].
n = 3, memoryBlocks = [0, 3, 4]
No operation: MEX = 1
x = 0, 0 -> 1 gives [1, 3, 4]: MEX = 0
answer = [0, 1]
[0, 0], the at-most-one reading gives [1, 2] (1 by doing nothing, 2 by one increment), while any number of increments, or increasing each block at most once, also reaches 0. Ask which is meant.n, but the posted example has 3 and 4 with n = 3. Such a block can never be increased.One report, from October 2025: a Citadel online assessment with two problems. This was the second; the first was the hackathon team-size problem. The candidate posts both prompts word for word and says it took ten minutes just to understand one problem; the thread's title compares the reading to the GRE. They found they had misread the first problem after solving it and did not solve this one.
The posted prompt contradicts itself on how often the operation can be used, and its example breaks its own value constraint. No other report of this problem was found, so there is no second account to settle either point.
There are n memory blocks, and the size of the i-th block is memoryBlocks[i] (0 ≤ i < n).
The operation: select an index x and increase memoryBlocks[x] by 1, but only if memoryBlocks[x] is less than n - 1.
The MEX (minimum excluded value) of the array is the smallest non-negative integer not present in it; the prompt calls it a Valid Size. Return every Valid Size that can be reached, sorted in ascending order.
Complete findValidSizes(memoryBlocks), which returns int[].
n = 3, memoryBlocks = [0, 3, 4]
No operation: MEX = 1
x = 0, 0 -> 1 gives [1, 3, 4]: MEX = 0
answer = [0, 1]
[0, 0], the at-most-one reading gives [1, 2] (1 by doing nothing, 2 by one increment), while any number of increments, or increasing each block at most once, also reaches 0. Ask which is meant.n, but the posted example has 3 and 4 with n = 3. Such a block can never be increased.Why people fail: The one reporting candidate did not solve this problem, the second of two in the OA; they say it took ten minutes to understand one problem's wording.
Send them this page. It is free to read, no account needed.
What you just read — canonical solution, follow-up arc, what passing candidates actually did — exists for all 62 Citadel questions, refreshed monthly from new candidate reports.