Skip to content

Instantly share code, notes, and snippets.

@kevinmeredith
Created April 4, 2013 02:04
Show Gist options
  • Select an option

  • Save kevinmeredith/5307133 to your computer and use it in GitHub Desktop.

Select an option

Save kevinmeredith/5307133 to your computer and use it in GitHub Desktop.
recursive Java function
private List<Integer> getStartTimes(List<Plane> inPlanes, List<Integer> startTimes, int index) {
if (inPlanes.size() == 0) {
return startTimes;
}
else {
startTimes.add(inPlanes.remove(index++).getDepartureTime());
return getStartTimes(inPlanes, startTimes, index);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment