We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
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
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Equal Stacks
You are viewing a single comment's thread. Return to all 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