Skip to main content
Back to problems
Leetcode
Medium
Strings
Arrays
Hash Maps
Reverse Degree Of A String

Compute the reverse degree of a string by summing each character's reversed alphabet position.

Acceptance 0%
Problem Statement

Problem

Given a string consisting of lowercase English letters, compute its reverse degree.

For each character c, assign a value based on its position from the end of the alphabet:

  • a = 26
  • b = 25
  • c = 24
  • ...
  • z = 1

The reverse degree of the string is the sum of these values for all characters in the string.

Task

Return the total reverse degree of the given string.

Notes

  • The string may contain repeated characters.
  • Each character contributes independently to the total.
  • This is a direct counting / mapping problem.

Input Format

A single string s containing lowercase English letters.

Output Format

Return an integer representing the reverse degree of s.

Constraints

1 <= |s| <= $10^{5}$s contains only lowercase English letters • The answer fits in a 32-bit signed integer

Examples
Sample cases returned by the problem API.

Example 1

Input

"abc"

Output

75

Explanation

a = 26, b = 25, c = 24, so the total is 26 + 25 + 24 = 75.

Example 2

Input

"zza"

Output

53

Explanation

z = 1, z = 1, a = 26, so the total is 1 + 1 + 26 = 28.

Premium problem context

Unlock deeper context for this problem

Premium adds guided hints, editorial links, similar variants, discussion resources, and concept maps so you can understand why a problem matters, not just solve it once.

Guided hints
Editorial and discussion links
Concept map and variants
Sign in to unlock
Track your progress
Sign in to bookmark this problem, save notes, and manage its revision plan.