Skip to content

Instantly share code, notes, and snippets.

@philippeantoine
Created April 4, 2011 21:37
Show Gist options
  • Save philippeantoine/902495 to your computer and use it in GitHub Desktop.
Save philippeantoine/902495 to your computer and use it in GitHub Desktop.
2011-04-04 codingdojo puissance4 randori
package dojo.kata;
import java.util.List;
public class Puissance4 {
public Object solve(List<List<Integer>> grid) {
boolean cpt = false;
int r=0;
int c=0;
for (List<Integer> currentColumn : grid) {
for (Integer currentRow : currentColumn) {
if (currentRow != null) {
r+=currentRow;
} else if (currentColumn.size() == 1) {
if (currentColumn.get(0) == 1) {
c+=1;
}
}
}
}
if (r==3 || c==3) {
return 1;
}
return 0;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment