class Solution {
public int maximum69Number
(int num
) {
int pos
= 0, temp
= num
, n
=1;
while(temp
!= 0) {
pos
= temp
% 10 == 6 ? n
: pos
;
temp
= temp
/ 10;
n
++;
}
return pos
== 0 ? num
: num
+ 3 * (int) Math
.pow(10, pos
- 1);
}
}
转载请注明原文地址: https://lol.8miu.com/read-2067.html