Amazon Interview Question

string and monotonic stack problems and queries