O(n) Straight forward solution ✅
Intuition\n Describe your first thoughts on how to solve this problem. \n- We can simply traverse through the array and find absoulte difference ASCII between t
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n- We can simply traverse through the array and find absoulte difference ASCII between two adjacent characters and return the sum of these differences.\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n- Declare a variable `score` and initialize it to 0.\n- Start a loop from 1 to n, and find absolute difference between character `s[i]` and `s[i-1]` and add it to` score`.\n- Return `score`.\n\n# Complexity\n- Time complexity:O(n)\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:O(1)\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution \n{\n    public int scoreOfString(String s) \n    {\n        int score = 0;\n        for(int i = 1; i < s.length(); i ++)\n        {\n            score += (Math.abs(s.charAt(i)-s.charAt(i-1)));\n        }\n        return score;\n    }\n}\n```
['String', 'Java']