Last active
December 2, 2015 14:01
-
-
Save opyate/eda45b57c488933cf828 to your computer and use it in GitHub Desktop.
model and maximizer
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package app; | |
public class Cake { | |
private Integer weight; | |
private Integer value; | |
public Cake(Integer weight, Integer value) { | |
this.weight = weight; | |
this.value = value; | |
} | |
public Integer getWeight() { | |
return this.weight; | |
} | |
public Integer getValue() { | |
return this.value; | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package app; | |
import java.util.List; | |
public class Maximizer { | |
public Integer getMax(List<Cake> cakes, Integer capacity) { | |
assert(capacity >= 0): "Negative capacity bag not allowed"; | |
// TODO provide an implementation below this line | |
Integer answer = 0; | |
return answer; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment