[面试题] Find next higher number with same digits

- 日理万妓 2021-12-03 07:23 284阅读 0赞

Find next higher number with same digits.

Example 1 : if num = 25468, o/p = 25486
Example 2 : if num = 21765, o/p = 25167
Example 3 : If num = 54321, o/p = 54321 (cause it’s not possible to gen a higher num than tiz with given digits ).

Google的面试题,实际上就是next_permutation。

转载于:https://www.cnblogs.com/easonliu/p/3643542.html

发表评论

表情:
评论列表 (有 0 条评论,284人围观)

还没有评论,来说两句吧...

相关阅读

    相关 Specialized Four-Digit Numbers

    找到并列出所有具有这样特性的十进制的四位数:其4位数字的和等于这个数字以十六进制表示时的4位数字的和,也等于这个数字以十二进制表示时的4位数字的和。 例如:十进制整数2991