Skip to content

Commit 084d4a1

Browse files
committed
added algorithm improvement
1 parent 28bb654 commit 084d4a1

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

src/main/java/com/team/hashcode/pizza/Pizza.java

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,12 @@ public void cutPizza(){
2626
int r = 0;
2727
int c = 0;
2828
boolean isWasAnotherIngredient = false;
29-
for(; c < columns; ) {
29+
for(; c < columns; c++) {
3030

3131
final Slice slice = new Slice(maxCellsPerSlice);
3232
char searchIngredient = matrix[r][c] == 'M' ? 'T' : 'M';
3333

34-
for(; r < row;){
34+
for(; r < row; r++){
3535

3636
if(sliceSize < maxCellsPerSlice) {
3737
if(searchIngredient == matrix[r][c]){
@@ -42,7 +42,6 @@ public void cutPizza(){
4242
slice.clear();
4343
}
4444
sliceSize++;
45-
r++;
4645
}else{
4746
r = 0;
4847
sliceSize = 0;
@@ -51,8 +50,6 @@ public void cutPizza(){
5150
}
5251

5352
}
54-
c++;
55-
5653
}
5754
}
5855

0 commit comments

Comments
 (0)