Algorithm · NVIDIA · Medium
Given a string s containing only uppercase letters from A through Z, create two functions that encode and decode it using the following rule: For every maximal consecutive sequence of the same character, write the character followed by its run length. Represent each run length using Excel column notation: A means 1, B means 2, through Z meaning 26, followed by AA for 27, and so on. The functions must satisfy: decompress(compress(s)) == s For example, four consecutive A…
Checking your access…