💯 Beats  || simple 🐣 || 4 language || Best Formatted 🫰||
\n# Screenshot \uD83C\uDF89 \n\n\n\n---\n\n\n\n# Intuition \uD83D\uDCDA\n\n    Given--> One String with\n    \n    Que description -->  (2 <= s.length <= 100)\n
\n# Screenshot \uD83C\uDF89 \n\n![3110 c.png](https://assets.leetcode.com/users/images/592632b6-dc2c-4ef7-ab32-c31117e6e010_1717216831.3929858.png)\n\n---\n\n![3110 java.png](https://assets.leetcode.com/users/images/ff80e2d8-1bbe-4347-8385-966fda4ed0a7_1717216845.5407774.png)\n\n# Intuition \uD83D\uDCDA\n\n    `Given`--> One String with\n    \n    `Que description` -->  (2 <= s.length <= 100)\n\n    we have to score of sum of the absolute difference \n\n    between the ASCII values of adjacent characters.\n\n# Approach \uD83D\uDD25\n\n       There will be 6 steps \n\n    Step 1 -> Make res variable with res = 0\n\n    Step 2 -> Apply for loop from 0 to len(nums) - 1  \n\n    Step 3 -> sub adjacent means next char from previous one \n\n    Step 4 -> add in res \n\n    Step 5 -> return res\n\n\n# Complexity \uD83D\uDCAB\n- \u231A Time complexity: $$O(n)$$\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- \u267B\uFE0F Space complexity: $$O(1)$$\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code \uD83D\uDC96\n\n```JAVA []\nclass Solution {\n    public int scoreOfString(String s) {\n        int res = 0;\n\n        for (int i = 0; i < s.length() - 1; i++) {\n            res += Math.abs(s.charAt(i) - s.charAt(i + 1));\n        }\n        return res;\n    }\n}\n```\n```JAVASCRIPT []\nvar scoreOfString = function (s) {\n    let res = 0;\n\n    for (let i = 0; i < s.length - 1; i++) {\n        res += Math.abs(s.charAt(i).charCodeAt(0) - s.charAt(i + 1).charCodeAt(0));\n    }\n    return res;\n};\n```\n```PYTHON []\nclass Solution:\n    def scoreOfString(self, s: str) -> int:\n        res = 0\n\n        for i in range(len(s) - 1):\n            res += abs(ord(s[i]) - ord(s[i + 1]))\n\n        return res\n\n```\n``` C []\nint scoreOfString(char* s) {\n    int res = 0;\n\n    for (int i = 0; i < strlen(s) - 1; i++) {\n        res += abs(s[i] - s[i + 1]);\n    }\n    return res;\n}\n```
['String', 'C', 'Java', 'Python3', 'JavaScript']