TheRealSamuel/LeetCodeProblem
0561
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": "1669420800000",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 "public_test_cases": [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 "private_test_cases": [21 {22 "input": [23 "480",24 "in",25 "982724505",26 "78",27 "69395",28 "92470",29 "88",30 "4180",31 "80098",32 "6awr7",33 "543757698",34 "8",35 "110qgebt",36 "4607",37 "8",38 "11284",39 "209u97b90",40 "nnq",41 "414507635",42 "o17o3ksl",43 "yhhwswi",44 "1124449",45 "74829325",46 "f",47 "a2zbd"48 ],49 "output": 98272450550 },51 {52 "input": [53 "30",54 "8055251",55 "33334793",56 "021288638",57 "957",58 "57ckrn",59 "x",60 "kzl9l",61 "4pp5k6",62 "1339419",63 "2",64 "7v183",65 "380704",66 "759312432",67 "ep",68 "0173927",69 "ip",70 "dzc",71 "2j06evpcj",72 "709877799",73 "03683652"74 ],75 "output": 75931243276 },77 {78 "input": [79 "xr55b20q",80 "41699",81 "0de277",82 "652441",83 "cbr4r",84 "kq2mlkj",85 "ikg0g5u",86 "5",87 "y7nt",88 "2ob",89 "5108192",90 "112",91 "722",92 "77e4eh",93 "2wrjdufu9",94 "wgkgsm62g",95 "85",96 "901",97 "ol",98 "jw03",99 "38403",100 "48996",101 "jf03gxegj",102 "53",103 "6y1321q",104 "511610",105 "3gkaob",106 "pmz1r5",107 "0k",108 "3168",109 "54",110 "4082480",111 "5",112 "nud8",113 "acl8d5",114 "rbvpsd"115 ],116 "output": 5108192117 },118 {119 "input": [120 "93045",121 "90",122 "320",123 "c3w21",124 "1967253",125 "4u97yz6gl",126 "819667249",127 "84166",128 "trcoxb",129 "i",130 "e1l",131 "081024766",132 "p0hzazk5",133 "92",134 "rwphk57li",135 "15867049",136 "7m4",137 "5",138 "7112",139 "zpg7",140 "052",141 "624544487",142 "f7",143 "ioeow2",144 "179",145 "s4zl",146 "803819710",147 "9354876",148 "wwskp0r2",149 "rl0ryrpk",150 "ev",151 "14751025",152 "k9it",153 "1",154 "2o",155 "60sm",156 "5",157 "3",158 "q",159 "gi",160 "aig17jl7a",161 "s7j",162 "217072",163 "dk3uc",164 "f9i7"165 ],166 "output": 819667249167 },168 {169 "input": [170 "gh6ky",171 "zsk",172 "jv3",173 "b6782c86",174 "0gz5",175 "23c51p",176 "dne21",177 "8v8ke5",178 "z",179 "j875bp",180 "mr",181 "383",182 "80637",183 "cfqu",184 "5947",185 "i4ite0v",186 "ndv",187 "wgc6cix",188 "8",189 "556837113",190 "l837dm34",191 "94744207",192 "5752",193 "aq",194 "1vu4",195 "674596",196 "b3kg3mf"197 ],198 "output": 556837113199 },200 {201 "input": [202 "ujuxvc3z",203 "5",204 "gzkvzxy",205 "zdvo8f2x9",206 "014324084",207 "291770653",208 "89323252",209 "713199242",210 "1hfogh7",211 "i6",212 "vexmm",213 "cdy815",214 "42156",215 "018213376",216 "l895",217 "vxqurlxq",218 "1w0",219 "2ju9",220 "g6mmm",221 "91414",222 "63012",223 "58929",224 "k9la25dy",225 "97gkhz",226 "1egcvod6i",227 "531755040",228 "1911",229 "781939292",230 "7",231 "063",232 "279707847",233 "813638",234 "3750914",235 "5486x40",236 "hz1wf6foa",237 "39956070",238 "34",239 "5",240 "4",241 "ejovy",242 "ghz",243 "gbdo",244 "d95zv",245 "gax",246 "78",247 "y2q6pw1",248 "76471",249 "2",250 "i4",251 "lftfo369",252 "88773",253 "rp",254 "739774",255 "3qecwa8zs",256 "3192",257 "8",258 "g8ez9msz",259 "ltgavrj",260 "442574",261 "46750393",262 "6456709",263 "3333080",264 "33",265 "nabayjb",266 "p0"267 ],268 "output": 781939292269 },270 {271 "input": [272 "dk8hbcoh",273 "56434",274 "484339",275 "20",276 "945605",277 "07tye",278 "n",279 "yik7ay5t",280 "629862",281 "pbsur2r0q",282 "j",283 "059097",284 "hr",285 "tkgv3eg",286 "z9yv7uqmg",287 "76046409",288 "464044405",289 "g9hq",290 "dxqiubvy",291 "eri",292 "ym22v"293 ],294 "output": 464044405295 },296 {297 "input": [298 "3bsb2q",299 "zgdtwd",300 "654807",301 "z3m4st",302 "361ax5"303 ],304 "output": 654807305 },306 {307 "input": [308 "73361",309 "ijh7ezjv1",310 "y3",311 "8",312 "ow34k4sb",313 "n",314 "1",315 "481342",316 "363363954",317 "2",318 "35701291",319 "80591",320 "wib",321 "3",322 "9",323 "yz",324 "oskid9x",325 "of",326 "5094",327 "xckz",328 "bizf3j",329 "7694141",330 "s",331 "254111548",332 "177639",333 "a8h",334 "umnfa9ur",335 "6",336 "3463981",337 "0",338 "747305121",339 "78883774",340 "37",341 "gdwm64qx",342 "5533150",343 "7905917",344 "17",345 "198350962",346 "rv1j0",347 "u9g13",348 "34054",349 "1btgv8cy",350 "xb0cyr",351 "z1k5t2b",352 "606344",353 "77",354 "96",355 "7i5b0",356 "61491",357 "122",358 "5596936",359 "58",360 "upezkej",361 "yuzi",362 "5894326",363 "skle3hnyj",364 "ntt18a5t4",365 "vwny",366 "64",367 "44w",368 "o",369 "6",370 "509183",371 "2e9om17",372 "ipv3e",373 "0xkf8q",374 "51280950"375 ],376 "output": 747305121377 },378 {379 "input": [380 "mbo",381 "891599",382 "bzj7",383 "w1",384 "1f45r8t5",385 "79476",386 "6976"387 ],388 "output": 891599389 }390 ],391 "haskell_template": "maximumValue :: [String] -> Int\nmaximumValue strs ",392 "ocaml_template": "let maximumValue (strs: string list) : int = ",393 "scala_template": "def maximumValue(strs: List[String]): Int = { \n \n}",394 "java_template": "public static int maximumValue(List<String> strs) {\n\n}",395 "python_template": "class Solution(object):\n def maximumValue(self, strs):\n \"\"\"\n :type strs: List[str]\n :rtype: int\n \"\"\"\n "396}