Skip to content

Instantly share code, notes, and snippets.

@zephiransas
Created October 5, 2015 06:31
Show Gist options
  • Save zephiransas/e970ba9a737263d6ac5a to your computer and use it in GitHub Desktop.
Save zephiransas/e970ba9a737263d6ac5a to your computer and use it in GitHub Desktop.
import java.time.Duration;
import java.time.LocalDateTime;
import java.time.Period;
import java.time.ZoneId;
public class Tarai {
public static int tarai(int x, int y, int z) {
if(x <= y) {
return y;
} else {
return tarai(tarai(x - 1, y, z), tarai(y - 1, z, x), tarai(z - 1, x, y));
}
}
public static void main(String[] args) {
LocalDateTime t1 = LocalDateTime.now();
int n = tarai(14, 8, 0);
LocalDateTime t2 = LocalDateTime.now();
System.out.println(n);
Duration duration = Duration.between(t1, t2);
System.out.println(duration);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment