FPEvalRepoPublic/LeetCodeMetaData
0399
1{2 "id": 2589,3 "name": "maximum-value-of-a-string-in-an-array",4 "difficulty": "Easy",5 "link": "https://leetcode.com/problems/maximum-value-of-a-string-in-an-array/",6 "date": "2022-11-26",7 "task_description": "The **value** of an alphanumeric string can be defined as: The **numeric** representation of the string in base `10`, if it comprises of digits **only**. The **length** of the string, otherwise. Given an array `strs` of alphanumeric strings, return _the **maximum value** of any string in _`strs`. **Example 1:** ``` **Input:** strs = [\"alic3\",\"bob\",\"3\",\"4\",\"00000\"] **Output:** 5 **Explanation:** - \"alic3\" consists of both letters and digits, so its value is its length, i.e. 5. - \"bob\" consists only of letters, so its value is also its length, i.e. 3. - \"3\" consists only of digits, so its value is its numeric equivalent, i.e. 3. - \"4\" also consists only of digits, so its value is 4. - \"00000\" consists only of digits, so its value is 0. Hence, the maximum value is 5, of \"alic3\". ``` **Example 2:** ``` **Input:** strs = [\"1\",\"01\",\"001\",\"0001\"] **Output:** 1 **Explanation:** Each string in the array has value 1. Hence, we return 1. ``` **Constraints:** `1 <= strs.length <= 100` `1 <= strs[i].length <= 9` `strs[i]` consists of only lowercase English letters and digits.",8 "test_case": [9 {10 "label": "Example 1",11 "input": "strs = [\"alic3\",\"bob\",\"3\",\"4\",\"00000\"]",12 "output": "5 "13 },14 {15 "label": "Example 2",16 "input": "strs = [\"1\",\"01\",\"001\",\"0001\"]",17 "output": "1 "18 }19 ],20 "constraints": [21 "The numeric representation of the string in base 10, if it comprises of digits only.",22 "The length of the string, otherwise.",23 "1 <= strs.length <= 100",24 "1 <= strs[i].length <= 9",25 "strs[i] consists of only lowercase English letters and digits."26 ],27 "python_template": "class Solution(object):\n def maximumValue(self, strs):\n \"\"\"\n :type strs: List[str]\n :rtype: int\n \"\"\"\n ",28 "java_template": "class Solution {\n public int maximumValue(String[] strs) {\n \n }\n}",29 "metadata": {30 "func_name": "maximumValue"31 }32}