[Rust] true one-liner
Approach\nA windowing iterator over the byte array representing the string is created. A map iterator producing the absolute difference of each adjacent pair of
# Approach\nA windowing iterator over the byte array representing the string is created. A map iterator producing the absolute difference of each adjacent pair of bytes is created, then `.sum()` is invoked on it to produce the sum of differences.\n\nThis is an actual "one-liner". I see a lot of solutions (to other problems) declaring themselves "one-liners" where combinator methods are tacked on to the ends of each other one after the other going on for 10 or more lines of code. Those are not "one-liners".\n\n# Complexity\n- Time complexity: $O(n)$\n- Space complexity: $O(1)$\n\n# Code\n``` rust\nimpl Solution {\n    pub fn score_of_string(s: String) -> i32 {\n        s.as_bytes().windows(2).map(|a| a[0].abs_diff(a[1]) as i32).sum()\n    }\n}\n```
['Rust']