Weekly Contest
限制 :
2 <= nums.length <= 100
1 <= nums[i] <= 10^4
注意題意是講說,數字的最大位一樣。這樣就可以很簡單解出來了。
程式碼:
限制 :
The number of nodes in the list is in the range [1, 104]
0 <= Node.val <= 9
The input is generated such that the list represents a number that does not have leading zeros, except the number 0 itself.
這題不算難,因為只有乘2,所以最多只會進一位,這樣就是用兩個指標,這兩個指標都會在相鄰位置,在右邊的負責把裡面的數字相乘,如果要進位,會請左邊指標的值加一。
程式碼:
限制 :
104
程式碼:
限制 :
104
程式碼: