awesome-leetcode-resources
awesome-leetcode-resources copied to clipboard
Javascript: Update stack[stack.length - 1] to stack.at(-1)
This PR updates the usage of array indexing from stack[stack.length - 1] to stack.at(-1) in the MonotonicStack class methods: nextGreaterElement(nums) dailyTemperatures(temperatures)
This change improves readability by using modern JavaScript syntax.
mdn web docs: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/at