739. Daily Temperatures

naive - two pointers

T: O(n^2)

T: O(n), with ans result

mono stack (decresing, 注意要判斷 decresing or increasing

T: O(n)

S: O(n), with ans result and stack

Array, Optimized Space

no stack

T: O(n)

S: O(n), with ans result

https://leetcode.com/problems/daily-temperatures/solution/

Last updated

Was this helpful?