Microsoft interview question

DSA question on monotonic stack