Skip to content

Instantly share code, notes, and snippets.

@stphung
Created May 29, 2011 21:35
Show Gist options
  • Select an option

  • Save stphung/998153 to your computer and use it in GitHub Desktop.

Select an option

Save stphung/998153 to your computer and use it in GitHub Desktop.
TopCoder SRM 507 Division 2 - 250 point problem
import java.util.ArrayList;
import java.util.List;
public class CubeAnts {
public int getMinimumSteps(int[] pos) {
List<Integer> l = new ArrayList<Integer>();
for (int i : pos) l.add(i);
if (l.contains(6)) return 3;
else if (l.contains(2) || l.contains(5) || l.contains(7)) return 2;
else if (l.contains(3) || l.contains(1) || l.contains(4)) return 1;
return 0;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment