CoolFace
Datasetpublic

TheRealSamuel/LeetCodeProblem

sourceHugging Faceupdated 2mo agoView on Hugging Face
0likes564downloads
1{2    "id": 3753,3    "name": "maximum_difference_between_even_and_odd_frequency_i",4    "difficulty": "Easy",5    "link": "https://leetcode.com/problems/maximum-difference-between-even-and-odd-frequency-i/",6    "date": "2025-01-26 00:00:00",7    "task_description": "You are given a string `s` consisting of lowercase English letters. Your task is to find the **maximum** difference between the frequency of **two** characters in the string such that: One of the characters has an **even frequency** in the string. The other character has an **odd frequency** in the string. Return the **maximum** difference, calculated as the frequency of the character with an odd frequency **minus** the frequency of the character with an even frequency. **Example 1:** **Input:** s = \"aaaaabbc\" **Output:** 3 **Explanation:** The character `'a'` has an **odd frequency** of `5`, and `'b'` has an **even frequency** of `2`. The maximum difference is `5 - 2 = 3`. **Example 2:** **Input:** s = \"abcabcab\" **Output:** 1 **Explanation:** The character `'a'` has an **odd frequency** of `3`, and `'c'` has an **even frequency** of 2. The maximum difference is `3 - 2 = 1`. **Constraints:** `3 <= s.length <= 100` `s` consists only of lowercase English letters. `s` contains at least one character with an odd frequency and one with an even frequency.",8    "public_test_cases": [9        {10            "label": "Example 1",11            "input": "s = \"aaaaabbc\"",12            "output": "3 "13        },14        {15            "label": "Example 2",16            "input": "s = \"abcabcab\"",17            "output": "1 "18        }19    ],20    "private_test_cases": [21        {22            "input": "bbzzrrrwwkkaaaafmmyvvnlllllljjtttggxxuoooqsciip",23            "output": 124        },25        {26            "input": "qqqqtoolzzsxkkjnhceu",27            "output": -128        },29        {30            "input": "hyzzxnfueqqvr",31            "output": -132        },33        {34            "input": "jjjexxllqqqrrrrrkkkfffihssaaauuuuppppvvnzgybcm",35            "output": 336        },37        {38            "input": "nnnjssssspprrrruuuwwhhhvvviiqqdddooobmmaafffgcccyxx",39            "output": 340        }41    ],42    "haskell_template": "maxDifference :: String -> Int\nmaxDifference s ",43    "ocaml_template": "let maxDifference (s: string) : int =  ",44    "scala_template": "def maxDifference(s: String): Int = { \n    \n}",45    "java_template": "class Solution {\n    public int maxDifference(String s) {\n        \n    }\n}",46    "python_template": "class Solution(object):\n    def maxDifference(self, s):\n        \"\"\"\n        :type s: str\n        :rtype: int\n        \"\"\"\n        "47}