title: How to implement three stacks using a single array
body: <p>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 space left in the entire array space. </p>
  
  <p>For implementing 2 stacks in an array, it's pretty obvious: 1st stack grows from LEFT to RIGHT, and 2nd stack grows from RIGHT to LEFT; and when the stackTopIndex crosses, it signals an overflow. </p>
  
  <p>Thanks in advance for your insightful answer. </p>