Challenge: Sort Stack

Let’s sort the elements of a stack.

Problem

Given a stack, sort elements such that the largest value is at the top.

Level up your interview prep. Join Educative to access 70+ hands-on prep courses.