TheRealSamuel/LeetCodeProblem
0564
1{2 "id": 2532,3 "name": "remove_letter_to_equalize_frequency",4 "difficulty": "Easy",5 "link": "https://leetcode.com/problems/remove-letter-to-equalize-frequency/",6 "date": "1663372800000",7 "task_description": "You are given a **0-indexed** string `word`, consisting of lowercase English letters. You need to select **one** index and **remove** the letter at that index from `word` so that the **frequency** of every letter present in `word` is equal. Return_ _`true`_ if it is possible to remove one letter so that the frequency of all letters in _`word`_ are equal, and _`false`_ otherwise_. **Note:** The frequency of a letter `x` is the number of times it occurs in the string. You **must** remove exactly one letter and cannot choose to do nothing. **Example 1:** ``` **Input:** word = \"abcc\" **Output:** true **Explanation:** Select index 3 and delete it: word becomes \"abc\" and each character has a frequency of 1. ``` **Example 2:** ``` **Input:** word = \"aazz\" **Output:** false **Explanation:** We must delete a character, so either the frequency of \"a\" is 1 and the frequency of \"z\" is 2, or vice versa. It is impossible to make all present letters have equal frequency. ``` **Constraints:** `2 <= word.length <= 100` `word` consists of lowercase English letters only.",8 "public_test_cases": [9 {10 "label": "Example 1",11 "input": "word = \"abcc\"",12 "output": "true "13 },14 {15 "label": "Example 2",16 "input": "word = \"aazz\"",17 "output": "false "18 }19 ],20 "private_test_cases": [21 {22 "input": "trvgjewrwhjyowlpufkffnsahxnjefyhtly",23 "output": false24 },25 {26 "input": "ytjzklqahkyacwgajbmamraavlcfpldgygwauzvvojobqkeuvpgxmzgswzlskfjxwmuxonzpffpsegbbrtxnwizdottb",27 "output": false28 },29 {30 "input": "bbdgqrazfakjvzdlj",31 "output": false32 },33 {34 "input": "jvblsapeffjfwqcsgpbhzkooqng",35 "output": false36 },37 {38 "input": "mhbutrqphctamehezfpdolirogihcfqisicjpvdzrhfvphshqtestgbgvjszojfkormijvcwxiqfhzpykjg",39 "output": false40 },41 {42 "input": "vhnufzaasiqtazljrtvhgsxmthconncjojqwcriohbwwn",43 "output": false44 },45 {46 "input": "hjuxmfeuffbsihrwlvaavitngeskenfzmxplbmlerxjlaayflvcvaovcrywsxkqmyud",47 "output": false48 },49 {50 "input": "sveyvtvroocsnoobjqtxydrnriulutyjkbbvfiazesdqfgbvzoneucwgrnvcyimootoyaefqsnouxvtuebbrxmqoohioahyjyaj",51 "output": false52 },53 {54 "input": "zplheoalkuxrueuichotb",55 "output": false56 },57 {58 "input": "boglbnsaxrzlwxzxkalxvpjuhduttelbjabziotuejffjjstbsu",59 "output": false60 }61 ],62 "haskell_template": "equalFrequency :: String -> Bool\nequalFrequency word ",63 "ocaml_template": "let equalFrequency (word: string) : bool = ",64 "scala_template": "def equalFrequency(word: String): Boolean = { \n \n}",65 "java_template": "public static boolean equalFrequency(String word) {\n\n}",66 "python_template": "class Solution(object):\n def equalFrequency(self, word):\n \"\"\"\n :type word: str\n :rtype: bool\n \"\"\"\n "67}