Excel Kata

Excel column encoding and decoding problem used in coding challenge

View project on GitHub

Back to AFitNerd

Excel Coding Challenge

In this coding challenge, you will exercise your basic algorithmic skills, your ability to setup a basic webapp and your ability to interact with an external API.

Background

You know how the columns in spreadsheets are identified by letters? They start with A and go through to Z. And what’s the column identifier after Z? AA, then AB and so on.

spreadsheet

The coding challenge is to write two functions. The first will take a positive integer greater than or equal to 1 and return the corresponding spreadsheet column notation. The second will take a string of letters and convert those letters to the corresponding column number.

Examples

toColNotation(1)        ->  A
toColNotation(27)       ->  AA
toColNotation(731)      ->  ABC

fromColNotation("A")    ->  1
fromColNotation("AA")   ->  27
fromColNotation("ABC")  ->  731

Specifics

To verify the results of your functions, there are two endpoints at your disposal:

https://code-challenge.afitnerd.com/v1/excel_kata/to_col_notation/:num
https://code-challenge.afitnerd.com/v1/excel_kata/from_col_notation/:str

Examples

curl https://code-challenge.afitnerd.com/v1/excel_kata/to_col_notation/1
-> {"result":"A"}

curl https://code-challenge.afitnerd.com/v1/excel_kata/from_col_notation/A
-> {"result":1}

App Requirements

  1. We should be able to run your code and query your server with:
    • http://localhost:<port>/code_challenge/to_col_notation/:num
    • http://localhost:<port>/code_challenge/from_col_notation/:str
  2. Must communicate with the https://code-challenge.afitnerd.com server to verify your algorithm
  3. Send over your code and some brief instructions so we can get it up and running locally
  4. Send us your code or a link to your repo at: [email protected]