Description
这里记录进制问题集合,非常简单,长期更新
- Related to question Excel Sheet Column Title
Given a column title as appear in an Excel sheet, return its corresponding column number.
For example:
A -> 1
B -> 2
C -> 3
…
Z -> 26
AA -> 27
AB -> 28 - Given a positive integer, return its corresponding column title as appear in an Excel sheet.
For example:
1 -> A
2 -> B
3 -> C
…
26 -> Z
27 -> AA
28 -> AB
Solution
[leetcode 171] Excel Sheet Column Number
很简单,就当成进制问题就可以了,然后一个递归就解决了:
|
|
[leetcode 168] Excel Sheet Column Title
也是递归问题,将大问题转小问题,这里取余的时候需要考虑除数的问题(26的问题)
|
|
近期评论