MCPcopy Create free account
hub / github.com/careercup/ctci / stackable_on

Method stackable_on

python/Chapter 9/Question9_10/tallest_stack.py:52–54  ·  view source on GitHub ↗

Return a Stack with the Boxes that can be stacked on 'bottom'.

(self, bottom)

Source from the content-addressed store, hash-verified

50 """ An immutable (and hashable) set of Boxes. """
51
52 def stackable_on(self, bottom):
53 """ Return a Stack with the Boxes that can be stacked on 'bottom'. """
54 return Stack(box for box in self if box < bottom)
55
56 def subtract(self, box):
57 """ Return a new Stack with 'box' removed. """

Callers 1

find_tallestMethod · 0.80

Calls 1

StackClass · 0.70

Tested by

no test coverage detected