⚠ 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
temperatures = [30,38,30,36,35,40,28]
to solve this we can create a parallel stack the parallel stack will hold the following: stack = [temp, index] we first iterate over the temperatures list and we create an inner while loop that starts from the top of the stack and checks if the value to the left of it is less than or greater than if the current temp is greater than the top of the stack we pop the value and calculate the index difference and append it to our result list when we’re not popping the values we append the temp and index to our running stack