Leetcode — 3110. 字符串得分
原文英文,约400词,阅读约需2分钟。发表于: 。It’s an easy problem from leet code with the description being: You are given a string s. The score of a string is defined as the sum of the absolute difference between the ASCII values of...
给定字符串s,其得分为相邻字符ASCII值的绝对差之和。例如,s = 'hello'得分为13,s = 'zaz'得分为50。通过遍历字符串计算得分,时间复杂度为O(n)。