最美情侣中文字幕电影,在线麻豆精品传媒,在线网站高清黄,久久黄色视频

歡迎光臨散文網 會員登陸 & 注冊

LeetCode 2710. Remove Trailing Zeros From a String

2023-05-28 15:06 作者:您是打尖兒還是住店呢  | 我要投稿

Given a?positive?integer?num?represented as a string, return?the integer?num?without trailing zeros as a string.

?

Example 1:

Input: num = "51230100"Output: "512301"Explanation: Integer "51230100" has 2 trailing zeros, we remove them and return integer "512301".

Example 2:

Input: num = "123"Output: "123"Explanation: Integer "123" has no trailing zeros, we return integer "123".

?

Constraints:

  • 1 <= num.length <= 1000

  • num?consists?of only digits.

  • num?doesn't?have any leading zeros.

使用stringbuilder的方法,因為stringbuilder有reverse的函數(shù)。

Runtime:?5 ms, faster than?50.00%?of?Java?online submissions for?Remove Trailing Zeros From a String.

Memory Usage:?44.4 MB, less than?12.50%?of?Java?online submissions for?Remove Trailing Zeros From a String.


LeetCode 2710. Remove Trailing Zeros From a String的評論 (共 條)

分享到微博請遵守國家法律
赫章县| 米泉市| 忻城县| 额尔古纳市| 北票市| 海安县| 安图县| 晋州市| 邮箱| 股票| 牟定县| 揭东县| 郴州市| 蚌埠市| 唐海县| 沙田区| 西昌市| 遵义县| 云霄县| 巴里| 上林县| 周宁县| 石城县| 原平市| 阜康市| 临漳县| 东方市| 龙井市| 清水县| 文登市| 新竹县| 双牌县| 乌审旗| 清镇市| 阿荣旗| 盘山县| 浠水县| 铜川市| 翁牛特旗| 申扎县| 万荣县|