Team Ai
Datasetpublic

FPEvalRepoPublic/LeetCodeMetaData

sourceHugging Faceupdated 9mo agoView on Hugging Face
0likes194downloads
odd-string-difference.json32 linesDownload Raw Back to root
1{2  "id": 2547,3  "name": "odd-string-difference",4  "difficulty": "Easy",5  "link": "https://leetcode.com/problems/odd-string-difference/",6  "date": "2022-10-15",7  "task_description": "You are given an array of equal-length strings `words`. Assume that the length of each string is `n`. Each string `words[i]` can be converted into a **difference integer array** `difference[i]` of length `n - 1` where `difference[i][j] = words[i][j+1] - words[i][j]` where `0 <= j <= n - 2`. Note that the difference between two letters is the difference between their **positions** in the alphabet i.e. the position of `'a'` is `0`, `'b'` is `1`, and `'z'` is `25`. For example, for the string `\"acb\"`, the difference integer array is `[2 - 0, 1 - 2] = [2, -1]`. All the strings in words have the same difference integer array, **except one**. You should find that string. Return_ the string in _`words`_ that has different **difference integer array**._ **Example 1:** ``` **Input:** words = [\"adc\",\"wzy\",\"abc\"] **Output:** \"abc\" **Explanation:** - The difference integer array of \"adc\" is [3 - 0, 2 - 3] = [3, -1]. - The difference integer array of \"wzy\" is [25 - 22, 24 - 25]= [3, -1]. - The difference integer array of \"abc\" is [1 - 0, 2 - 1] = [1, 1]. The odd array out is [1, 1], so we return the corresponding string, \"abc\". ``` **Example 2:** ``` **Input:** words = [\"aaa\",\"bob\",\"ccc\",\"ddd\"] **Output:** \"bob\" **Explanation:** All the integer arrays are [0, 0] except for \"bob\", which corresponds to [13, -13]. ``` **Constraints:** `3 <= words.length <= 100` `n == words[i].length` `2 <= n <= 20` `words[i]` consists of lowercase English letters.",8  "test_case": [9    {10      "label": "Example 1",11      "input": "words = [\"adc\",\"wzy\",\"abc\"]",12      "output": "\"abc\" "13    },14    {15      "label": "Example 2",16      "input": "words = [\"aaa\",\"bob\",\"ccc\",\"ddd\"]",17      "output": "\"bob\" "18    }19  ],20  "constraints": [21    "For example, for the string \"acb\", the difference integer array is [2 - 0, 1 - 2] = [2, -1].",22    "3 <= words.length <= 100",23    "n == words[i].length",24    "2 <= n <= 20",25    "words[i] consists of lowercase English letters."26  ],27  "python_template": "class Solution(object):\n    def oddString(self, words):\n        \"\"\"\n        :type words: List[str]\n        :rtype: str\n        \"\"\"\n        ",28  "java_template": "class Solution {\n    public String oddString(String[] words) {\n        \n    }\n}",29  "metadata": {30    "func_name": "oddString"31  }32}