Antwort
Nevermind. Hab wohl zu schnell gepostet. Mir ist der Knoten jetzt aufgegangen. Für alle die diesen Post in Zukunft mal lesen hier meine Lösung:
public static int fib (int n) {
int current;
int result = 0;
Stack<Integer> stack = new Stack<Integer>();
stack.push(n);
while (!stack.isEmpty()) {
current = stack.pop();
if (current > 1) {
stack.push(current - 1);
stack.push(current - 2);
}
else{
result += current;
}
}
return result;
}