Skip to content

Commit

Permalink
add 1-lines java solution for Excel-Sheet-Column-Title
Browse files Browse the repository at this point in the history
  • Loading branch information
xcv58 committed Dec 21, 2014
1 parent 1a4a50a commit 4a553a7
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions Excel-Sheet-Column-Title/Solution.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
public class Solution {
public String convertToTitle(int n) {
if (n == 0) { return ""; }
return convertToTitle(--n / 26) + (char)('A' + (n % 26));
return n == 0 ? "" : convertToTitle(--n / 26) + (char)('A' + (n % 26));
}
}

0 comments on commit 4a553a7

Please sign in to comment.