MCPcopy Index your code
hub / github.com/careercup/ctci / stackHeight

Method stackHeight

java/Chapter 9/Question9_10/Question.java:8–17  ·  view source on GitHub ↗
(ArrayList<Box> boxes)

Source from the content-addressed store, hash-verified

6public class Question {
7
8 public static int stackHeight(ArrayList<Box> boxes) {
9 if (boxes == null) {
10 return 0;
11 }
12 int h = 0;
13 for (Box b : boxes) {
14 h += b.height;
15 }
16 return h;
17 }
18
19 public static ArrayList<Box> createStackR(Box[] boxes, Box bottom) {
20 int max_height = 0;

Callers 2

createStackRMethod · 0.95
createStackDPMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected