⚠ Switch to EXCALIDRAW VIEW in the MORE OPTIONS menu of this document. ⚠ You can decompress Drawing data with the command palette: ‘Decompress current Excalidraw file’. For more info check in plugin settings under ‘Saving’

Excalidraw Data

Text Elements

height = [0,2,0,3,1,0,1,3,2,1]

Output: 9

  • start with a left and right pointer
  • while left pointer is < right pointer
  • if the left pointer’s value is less than the right
    • look at the next bar
    • we care about the max value so we grab the max value
    • we find the area by subtracting our max value with height of the next bar
  • Repeat the same process for the right pointer
  • return result

Embedded Files

afeae3ca68924125911025e59a39f1fa42d33b79: Pasted image 20241124133237.webp