Equal Stacks

  • + 0 comments

    I do not understand the following explanation for: h1 = [1,2,1,1] h2 = [1,1,2] h3 = [1,1] There are 4, 3, and 2 cylinders in the three stacks, with their heights in the three arrays. Remove the top 2 cylinders from h1 (heights = [1, 2]) and from h2 (heights = [1, 1]) so that the three stacks all are 2 units tall. Return 2 as the answer.

    h1 (heights = [1, 2]) has height 3, while h2 (heights = [1, 1]) has height 2, so the answer should be 1