> For the complete documentation index, see [llms.txt](https://851958789.gitbook.io/notes/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://851958789.gitbook.io/notes/0402_remove_k_digits/slt.md).

# 思路1

对于两个数 123a456 和 123b456，如果 a > b， 那么数字 123a456 大于 数字 123b456，否则数字 123a456 小于等于数字 123b456。也就说，两个相同位数的数字大小关系取决于第一个不同的数的大小。

* 从左到右遍历
* 对于每一个遍历到的元素，我们决定是丢弃还是保留。

如果stk尾部元素大于当前元素，则抛弃stk尾部元素

利用栈或双端队列，本质上是以空间换时间的方法。

时间复杂度O(N) 空间复杂度O(N)
