mirror of
https://github.com/arkorty/LeetCode.git
synced 2026-03-18 00:57:17 +00:00
Initial commit
This commit is contained in:
14
Easy/excel-sheet-column-title/Solution.java
Normal file
14
Easy/excel-sheet-column-title/Solution.java
Normal file
@@ -0,0 +1,14 @@
|
||||
class Solution {
|
||||
public String convertToTitle(int num) {
|
||||
StringBuilder ttl = new StringBuilder();
|
||||
|
||||
while (num > 0) {
|
||||
--num;
|
||||
char tba = (char) (num % 26 + 65);
|
||||
ttl.insert(0, tba);
|
||||
num /= 26;
|
||||
}
|
||||
|
||||
return ttl.toString();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user