python C++速解Leetcode 1945 Sum of Digits of String After Convert

Опубликовано: 18 Май 2026
на канале: An-Wen Deng
318
like

python C++速解Leetcode 1945 Sum of Digits of String After Convert
這是個簡單問題,有技巧。
第一次轉換不需要用bigINT來存,只是將數字與第1輪的數字相加即可。
由於s.length最多可能為100,因此使用bigInt或其他字串效率非常低。
---
This is an easy question with some tricks.
The first conversion does not need to use a bigINT to hold, but just add the digits to the number in the 1st round.
Since s.length may be 100 at most, it's very inefficient to use bigInt or other string.
[codes on Leetcode]https://leetcode.com/problems/sum-of-...
[Leetcode Playlist]   • C++ UnionFind  BFS DFS解圖論問題Leetcode 1971 F...