I came across this problem in an interview website. The problem asks for efficiently implement three stacks in a single array, such that no stack overflows until there is no
Split array in any 3 parts (no matter if you'll split it sequentially or interleaved). If one stack grows greater than 1/3 of array you start filling ends of rest two stacks from the end.
aaa bbb ccc 1 2 3 145 2 3 145 2 6 3 145 2 6 3 7 145 286 3 7 145 286 397
The worse case is when two stacks grows up to 1/3 boundary and then you have 30% of space waste.