Help with "Catching rainwater" interview question and code challenge passing only 4/5 test case

Hello everyone. My code solution works on my own IDE and codeAcademy site. But it only passes 4/5 test cases. I can seem to figure out what is the 5th test case my code if failing. I’d appreciate any help insight. Thanks.

Link: https://www.codecademy.com/code-challenges/code-challenge-capturing-rainwater-java

My code:

public class CapturingRainwater {
  public static void main(String[] args) {
    int[] heights = new int[] {4, 2, 1, 3, 0, 1, 2};
    System.out.println(capturingRainwater(heights));
  }
  public static int capturingRainwater(int[] heights) {
    // Write your code here
    // size of array
    int n = heights.length;
    if(heights == null ) return 0;
    if(n < 1) return 0; 
    if(n < 3) return 0;
    // Initialize var to store water
    int water = 0;
    // left array
    int[] left = new int[n];
    // right array
    int[] right = new int[n];
  //fill left array with pre-calculated tallest values
    left[0] = heights[0];
    for(int i=1; i < n; i++) {
      left[i] = Math.max(left[i-1],heights[i]);
    }
   //fill right array with pre-calculated tallest values
    right[n-1] = heights[n-1];
    for(int i=n-2; i >= 0; i--) {
      right[i] = Math.max(right[i+1],heights[i]);
    }
   // traverse array store water
   for(int i=0; i < n; i++) {
     water += Math.min(left[i],right[i] - heights[i]);
   }
   return water;
  }
}