删除k个数字后的最小值

编程入门 行业动态 更新时间:2024-10-24 14:19:37

删除k个数字后的<a href=https://www.elefans.com/category/jswz/34/1768825.html style=最小值"/>

删除k个数字后的最小值

给定一个只包含数字的字符串,要求在原字符串基础上删除k个数字后,使新字符串的数字最小。

题目来源:LeetCode-402. Remove K Digits,原题目如下:

Given a non-negative integer num represented as a string, remove k digits from the number so that the new number is the smallest possible.

Note:

  • The length of num is less than 10002 and will be ≥ k.
  • The given num does not contain any leading zero.

 先考虑只删除一个数字的情况,比如:1753,删除一个元素后最小的数字为:153;再如:6493,删除一个元素后最小的数为:493;再如,12345&#

更多推荐

删除k个数字后的最小值

本文发布于:2024-02-24 15:13:01,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1695726.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:最小值   数字

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!