# Challenge: Sort Values in a Stack

Try to solve Sort Values in a Stack problem.

## We'll cover the following

## Statement

Given a stack of integers, `stack`

, sort its elements in ascending order. In the resulting stack, the smallest element should be at the top.

**Constraints:**

$1 \leq$ `stack.length`

$\leq 10^3$ $-10^3 \leq$ `stack[i]`

$\leq 10^3$

## Examples

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