1 Star 0 Fork 1

dllearn/geektime-algorithm-learn

Create your Gitee Account
Explore and code with more than 13.5 million developers,Free private repositories !:)
Sign up
文件
Clone or Download
f.go 365 Bytes
Copy Edit Raw Blame History
dryyun authored 2022-04-16 23:13 +08:00 . rename 0066
package _066_plus_one
// 66. 加一
// https://leetcode-cn.com/problems/plus-one/
func plusOne(digits []int) []int {
into := 1
for i := len(digits) - 1; i >= 0; i-- {
if digits[i]+into == 10 {
digits[i] = 0
into = 1
} else {
digits[i] = digits[i] + into
into = 0
}
}
if into == 1 {
digits = append([]int{1}, digits...)
}
return digits
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/dllearn/geektime-algorithm-learn.git
git@gitee.com:dllearn/geektime-algorithm-learn.git
dllearn
geektime-algorithm-learn
geektime-algorithm-learn
55fa3f222b36

Search