trapping-rain-water.java - import java.util.ArrayList class Solution public int trap(int height int size = height.length int left = new int[size int

trapping-rain-water.java - import java.util.ArrayList class...

This preview shows page 1 out of 1 page.

import java.util.ArrayList; class Solution { public int trap(int[] height) { int size = height.length; int[] left = new int[size]; int[] right = new int[size]; int left_max = -1, right_max = -1; for (int i = 0; i < size; i++){ left[i] = left_max = Math.max(left_max, height[i]);
Image of page 1

You've reached the end of your free preview.

Want to read the whole page?

  • Fall '19
  • Left-wing politics, int size, public int trap

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

Stuck? We have tutors online 24/7 who can help you get unstuck.
A+ icon
Ask Expert Tutors You can ask You can ask You can ask (will expire )
Answers in as fast as 15 minutes