Problem · Math
Triple-Position Alphabet Encoding
Learn this problemProblem statement
Map the letters A through Z to positions 1 through 26. Given value, compute 3 * value and wrap positions cyclically after 26.
Return the letter at the resulting one-based position. For example, 1 maps to C and 2 maps to F.
Function
encodeTriplePosition(value: int) → StringExamples
Example 1
value = 1return = "C"Three times one is alphabet position 3, which is C.
Example 2
value = 2return = "F"Three times two is alphabet position 6, which is F.
Example 3
value = 9return = "A"Position 27 wraps to position 1, which is A.
Constraints
1 <= value <= 1000