I drink a lot of coke.I place the empty cans in a series of stacks, all in a straight line. When I view this series of stacks from the front, I can’t always see all the cans, or even all of the stacks, because sometimes a stack can be entirely obscured by a larger stack. When I view the series of stacks from the front, I can infer a minimum number of total cans. I can see each stack that is strictly larger than all the stacks between it and the front of the structure. For each stack I can see, I know how many cans are used to construct that stack. I then total up the number of cans that I know must exist: let’s call this number A. I then say I infer A cans in this structure.Suppose a series of stacks has the following stack sizes, in order from the front to the back: {1, 4, 3, 4, 6, 6, 2}. I’m able to infer 11 cans from this series: I can see the first, second, and fifth stacks (with 1, 4 and 6 cans respectively).Can you write a program that takes a series of stacks, and tells me how many cans I can infer?
The expert did excellent work as usual and was extremely helpful for me.
"Assignmentexpert.com" has experienced experts and professional in the market. Thanks.
Comments