Skip to content

Instantly share code, notes, and snippets.

@gresrun
Last active December 25, 2015 15:25
Show Gist options
  • Save gresrun/c65e9b3b99eaf718b2c2 to your computer and use it in GitHub Desktop.
Save gresrun/c65e9b3b99eaf718b2c2 to your computer and use it in GitHub Desktop.
public class GoNumSquares {
private static final int BOARD_SIZE = 19;
public static void main(final String... args) {
int squareSum = 0;
for (int i = BOARD_SIZE; i > 0; i--) {
final int dim = (BOARD_SIZE - i) + 1;
squareSum += (dim * dim);
}
System.out.println(squareSum);
}
}
@gresrun
Copy link
Author

gresrun commented Jun 12, 2015

Result: 2470

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment