Skip to content

Instantly share code, notes, and snippets.

@anton0xf
Created October 24, 2014 10:45
Show Gist options
  • Select an option

  • Save anton0xf/5af0cb1258e695bec76b to your computer and use it in GitHub Desktop.

Select an option

Save anton0xf/5af0cb1258e695bec76b to your computer and use it in GitHub Desktop.
public static int[] arrange(int m, int n) {
int res[] = new int[m];
if (n > 0) {
int s = 0;
for (int i = m - 1; i >= 0; i--) {
s += n;
if (s >= m) {
res[i]++;
s -= m;
}
}
}
return res;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment