package leetcode;

/**
 * https://leetcode.com/problems/n-th-tribonacci-number/
 */
public class Problem1137 {
    public int tribonacci(int n) {
        // TODO
        return 0;
    }

    public static void main(String[] args) {
        Problem1137 prob = new Problem1137();
        System.out.println(prob.tribonacci(4)); // 4
    }
}

@@ -151,32 +151,48 @@
     
-// TODO%0A        return 0
+return tribonacci(n, new Integer%5Bn + 1%5D)
 ;%0A  
@@ -205,21 +205,22 @@
    p
-ublic
+rivate
  static 
 void
@@ -219,133 +219,422 @@
 tic 
-void main(String%5B%5D args) %7B%0A        Problem1137 prob = new Problem1137();%0A        System.out.println(prob.tribonacci(4)); // 4
+int tribonacci(int n, Integer%5B%5D memo) %7B%0A        if (n == 0) %7B%0A            return 0;%0A        %7D%0A        if (n == 1) %7B%0A            return 1;%0A        %7D%0A        if (n == 2) %7B%0A            return 1;%0A        %7D%0A        if (memo%5Bn%5D != null) %7B%0A            return memo%5Bn%5D;%0A        %7D%0A        int value = tribonacci(n - 1, memo) + tribonacci(n - 2, memo) + tribonacci(n - 3, memo);%0A        memo%5Bn%5D = value;%0A        return value;
 %0A   

Solve problem 1137