File tree Expand file tree Collapse file tree 2 files changed +14
-2
lines changed
src/main/java/com/team/hashcode/pizza Expand file tree Collapse file tree 2 files changed +14
-2
lines changed Original file line number Diff line number Diff line change 3
3
import java .util .ArrayList ;
4
4
import java .util .List ;
5
5
6
+ /**
7
+ *
8
+ * 1. Save slice only after checking valid slice, I mean :
9
+ * - size <= maxCellsPerSlice
10
+ * - not cover already defined slices
11
+ * - slice contain minEachIngredient per slice
12
+ * 2. Mark slice's coordinates in matrixCopy as * in order to avoid covering
13
+ * 3. Keep in mind even and odd numbers in slice
14
+ *
15
+ * */
6
16
public class Pizza {
7
17
8
18
private char [][] matrix ;
9
19
private char [][] matrixCopy ;
10
20
private int maxCellsPerSlice ;
21
+ private int minEachIngredient ;
11
22
final List <Slice > slices = new ArrayList <>();
12
23
13
24
private int row ;
14
25
private int columns ;
15
26
16
- public Pizza (char [][] matrix , int maxCellsPerSlice ) {
27
+ public Pizza (char [][] matrix , int maxCellsPerSlice , int minEachIngredient ) {
17
28
this .matrix = matrix ;
18
29
this .matrixCopy = matrix ;
19
30
this .maxCellsPerSlice = maxCellsPerSlice ;
31
+ this .minEachIngredient = minEachIngredient ;
20
32
this .row = matrix .length ;
21
33
this .columns = matrix [0 ].length ;
22
34
}
Original file line number Diff line number Diff line change @@ -20,7 +20,7 @@ public static void main(String[] args) throws Exception {
20
20
strings = strings .subList (1 , strings .size ());
21
21
char [][] matrix = createMatrix (strings );
22
22
23
- Pizza pizza = new Pizza (matrix , maxCellsPerSlice );
23
+ Pizza pizza = new Pizza (matrix , maxCellsPerSlice , minEachIngredient );
24
24
pizza .cutPizza ();
25
25
List <Slice > slices = pizza .getSlices ();
26
26
You can’t perform that action at this time.
0 commit comments