// Java · Spring · Kafka · Algorithms

Practical guides to Java, Spring and algorithms, with code you can run.

Each article explains one topic around a complete example you can copy and run.

Java
static int fibonacciOptimized(int n) {
  int prev1 = 1;
  int prev2 = 1;
  for(int i=2; i<=n; i++) {
      int currentFib = prev1 + prev2;
      prev1 = prev2;
      prev2 = currentFib;
  }
  return prev2;
}
Fibonacci in O(n) time and O(1) space. See how it is derived
569
algorithm problems
126
Java articles
54
Spring articles
21
problem categories