Data Structures & AlgorithmsModerateSSC CGL Tier 2 · TCS NQT

Problem: The mapping of letters is A=1 through Z=26. What is the sum of the values of the letters in the word "MATH"?

  1. A. 38
  2. B. 298
  3. C. 42
  4. D. 66

Correct answer: C. 42

M = 13, A = 1, T = 20, H = 8, total 42. Using 0-based positions gives 38, adding ASCII codes gives 298, and reversed positions (Z = 1) give 66.

More Coding Interview Problems questions

Exams that ask this topic