Problems > Spreadsheet Column Name > Editorial

Spreadsheet Column Name — Solution & Editorial

Back to the Problem

Bijective base 26: repeatedly take (N−1) mod 26 as the digit and divide — the −1 handles the missing zero digit.

Complexity: O(log26 N)

Watch out: This is NOT plain base 26 — there is no zero, hence the (N−1) shift each step.