五月天青色头像情侣网名,国产亚洲av片在线观看18女人,黑人巨茎大战俄罗斯美女,扒下她的小内裤打屁股

歡迎光臨散文網(wǎng) 會(huì)員登陸 & 注冊(cè)

Leetcode 2566. Maximum Difference by Remapping a Digit

2023-02-19 09:10 作者:您是打尖兒還是住店呢  | 我要投稿

You are given an integer?num. You know that Danny Mittal will sneakily?remap?one of the?10?possible digits (0?to?9) to another digit.

Return?the difference between the maximum and minimum?values Danny can make by remapping?exactly?one?digit?in?num.

Notes:

  • When Danny remaps a digit?d1?to another digit?d2, Danny replaces all occurrences of?d1?in?num?with?d2.

  • Danny can remap a digit to itself, in which case?num?does not change.

  • Danny can remap different digits for obtaining minimum and maximum values respectively.

  • The resulting number after remapping can contain leading zeroes.

  • We mentioned "Danny Mittal" to congratulate him on being in the top 10 in Weekly Contest 326.

?

Example 1:

Input: num = 11891Output: 99009Explanation: To achieve the maximum value, Danny can remap the digit 1 to the digit 9 to yield 99899. To achieve the minimum value, Danny can remap the digit 1 to the digit 0, yielding 890. The difference between these two numbers is 99009.

Example 2:

Input: num = 90Output: 99Explanation:The maximum value that can be returned by the function is 99 (if 0 is replaced by 9) and the minimum value that can be returned by the function is 0 (if 9 is replaced by 0). Thus, we return 99.

?

Constraints:

  • 1 <= num <= 10e8;



Runtime:?1 ms, faster than?100.00%?of?Java?online submissions for?Maximum Difference by Remapping a Digit.

Memory Usage:?39.4 MB, less than?16.67%?of?Java?online submissions for?Maximum Difference by Remapping a Digit.


Leetcode 2566. Maximum Difference by Remapping a Digit的評(píng)論 (共 條)

分享到微博請(qǐng)遵守國(guó)家法律
苏尼特右旗| 浠水县| 涞水县| 肥西县| 玉山县| 高雄市| 玉环县| 易门县| 呼和浩特市| 富裕县| 兴安县| 田东县| 临湘市| 新田县| 若羌县| 元谋县| 凭祥市| 蒙山县| 武宁县| 桦川县| 门头沟区| 静宁县| 遵义市| 湘阴县| 延边| 麻江县| 波密县| 京山县| 玉环县| 开平市| 特克斯县| 南宁市| 图们市| 新竹市| 扬州市| 板桥市| 黎川县| 永德县| 哈尔滨市| 麻江县| 荥经县|