awesome-leetcode-resources icon indicating copy to clipboard operation
awesome-leetcode-resources copied to clipboard

Javascript: Update stack[stack.length - 1] to stack.at(-1)

Open PoornakumarRasiraju opened this issue 4 months ago • 0 comments

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

image

PoornakumarRasiraju avatar Jul 22 '25 07:07 PoornakumarRasiraju