We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent d35c46b commit e8cfc26Copy full SHA for e8cfc26
problems/excel-sheet-column-title/excel_sheet_column_title.go
@@ -1,8 +1,8 @@
1
package excel_sheet_column_title
2
3
func convertToTitle(n int) string {
4
- if n < 27 {
5
- return string(n - 1 + 'A')
+ if n--; n < 26 {
+ return string(n + 'A')
6
}
7
- return convertToTitle((n-1)/26) + string((n-1)%26+'A')
+ return convertToTitle(n/26) + string(n%26+'A')
8
0 commit comments